|
| 1 | +Exceptions |
| 2 | +========= |
| 3 | + |
| 4 | +.. module:: ocpp.exceptions |
| 5 | + |
| 6 | +The exceptions module contains custom exceptions used by the OCPP library. |
| 7 | + |
| 8 | +Base Exception |
| 9 | +------------- |
| 10 | + |
| 11 | +.. exception:: OCPPError |
| 12 | + |
| 13 | + Base class for all OCPP errors. This class should not be raised directly, only its subclasses. |
| 14 | + |
| 15 | + :param description: Description of the error |
| 16 | + :type description: str, optional |
| 17 | + :param details: Additional details about the error |
| 18 | + :type details: dict, optional |
| 19 | + |
| 20 | + .. attribute:: default_description |
| 21 | + :type: str |
| 22 | + |
| 23 | + Default description used if no description is provided. |
| 24 | + |
| 25 | + .. attribute:: code |
| 26 | + :type: str |
| 27 | + |
| 28 | + The error code used in OCPP CallError messages. Defined in subclasses. |
| 29 | + |
| 30 | +Protocol Error Exceptions |
| 31 | +----------------------- |
| 32 | + |
| 33 | +.. exception:: NotImplementedError |
| 34 | + |
| 35 | + Raised when a requested action is recognized but not supported by the receiver. |
| 36 | + |
| 37 | + .. attribute:: code |
| 38 | + :type: str |
| 39 | + :value: "NotImplemented" |
| 40 | + |
| 41 | + .. attribute:: default_description |
| 42 | + :type: str |
| 43 | + :value: "Request Action is recognized but not supported by the receiver" |
| 44 | + |
| 45 | +.. exception:: NotSupportedError |
| 46 | + |
| 47 | + Raised when a requested action is not known by the receiver. |
| 48 | + |
| 49 | + .. attribute:: code |
| 50 | + :type: str |
| 51 | + :value: "NotSupported" |
| 52 | + |
| 53 | + .. attribute:: default_description |
| 54 | + :type: str |
| 55 | + :value: "Requested Action is not known by receiver" |
| 56 | + |
| 57 | +.. exception:: InternalError |
| 58 | + |
| 59 | + Raised when an internal error occurred and the receiver was not able to process the request. |
| 60 | + |
| 61 | + .. attribute:: code |
| 62 | + :type: str |
| 63 | + :value: "InternalError" |
| 64 | + |
| 65 | + .. attribute:: default_description |
| 66 | + :type: str |
| 67 | + :value: "An internal error occurred and the receiver was not able to process the requested Action successfully" |
| 68 | + |
| 69 | +.. exception:: ProtocolError |
| 70 | + |
| 71 | + Raised when the payload for an action is incomplete. |
| 72 | + |
| 73 | + .. attribute:: code |
| 74 | + :type: str |
| 75 | + :value: "ProtocolError" |
| 76 | + |
| 77 | + .. attribute:: default_description |
| 78 | + :type: str |
| 79 | + :value: "Payload for Action is incomplete" |
| 80 | + |
| 81 | +.. exception:: SecurityError |
| 82 | + |
| 83 | + Raised when a security issue prevents the receiver from completing the action. |
| 84 | + |
| 85 | + .. attribute:: code |
| 86 | + :type: str |
| 87 | + :value: "SecurityError" |
| 88 | + |
| 89 | + .. attribute:: default_description |
| 90 | + :type: str |
| 91 | + :value: "During the processing of Action a security issue occurred preventing receiver from completing the Action successfully" |
| 92 | + |
| 93 | +Format Violation Exceptions |
| 94 | +------------------------- |
| 95 | + |
| 96 | +.. exception:: FormatViolationError |
| 97 | + |
| 98 | + Raised when the payload for an action is syntactically incorrect. |
| 99 | + |
| 100 | + .. attribute:: code |
| 101 | + :type: str |
| 102 | + :value: "FormatViolation" |
| 103 | + |
| 104 | + .. attribute:: default_description |
| 105 | + :type: str |
| 106 | + :value: "Payload for Action is syntactically incorrect or structure for Action" |
| 107 | + |
| 108 | +.. exception:: FormationViolationError |
| 109 | + |
| 110 | + Used for strict OCPP 1.6 compliance (typo in the specification). |
| 111 | + |
| 112 | + .. attribute:: code |
| 113 | + :type: str |
| 114 | + :value: "FormationViolation" |
| 115 | + |
| 116 | + .. attribute:: default_description |
| 117 | + :type: str |
| 118 | + :value: "Payload for Action is syntactically incorrect or structure for Action" |
| 119 | + |
| 120 | +Constraint Violation Exceptions |
| 121 | +----------------------------- |
| 122 | + |
| 123 | +.. exception:: PropertyConstraintViolationError |
| 124 | + |
| 125 | + Raised when a field contains an invalid value. |
| 126 | + |
| 127 | + .. attribute:: code |
| 128 | + :type: str |
| 129 | + :value: "PropertyConstraintViolation" |
| 130 | + |
| 131 | + .. attribute:: default_description |
| 132 | + :type: str |
| 133 | + :value: "Payload is syntactically correct but at least one field contains an invalid value" |
| 134 | + |
| 135 | +.. exception:: OccurenceConstraintViolationError |
| 136 | + |
| 137 | + Used for strict OCPP 1.6 compliance (typo in the specification). |
| 138 | + |
| 139 | + .. attribute:: code |
| 140 | + :type: str |
| 141 | + :value: "OccurenceConstraintViolation" |
| 142 | + |
| 143 | + .. attribute:: default_description |
| 144 | + :type: str |
| 145 | + :value: "Payload for Action is syntactically correct but at least one of the fields violates occurence constraints" |
| 146 | + |
| 147 | +.. exception:: OccurrenceConstraintViolationError |
| 148 | + |
| 149 | + Raised when a field violates occurrence constraints. |
| 150 | + |
| 151 | + .. attribute:: code |
| 152 | + :type: str |
| 153 | + :value: "OccurrenceConstraintViolation" |
| 154 | + |
| 155 | + .. attribute:: default_description |
| 156 | + :type: str |
| 157 | + :value: "Payload for Action is syntactically correct but at least one of the fields violates occurence constraints" |
| 158 | + |
| 159 | +.. exception:: TypeConstraintViolationError |
| 160 | + |
| 161 | + Raised when a field violates data type constraints. |
| 162 | + |
| 163 | + .. attribute:: code |
| 164 | + :type: str |
| 165 | + :value: "TypeConstraintViolation" |
| 166 | + |
| 167 | + .. attribute:: default_description |
| 168 | + :type: str |
| 169 | + :value: "Payload for Action is syntactically correct but at least one of the fields violates data type constraints (e.g. \"somestring\": 12)" |
| 170 | + |
| 171 | +Other Exceptions |
| 172 | +-------------- |
| 173 | + |
| 174 | +.. exception:: GenericError |
| 175 | + |
| 176 | + Generic error for all other types of errors. |
| 177 | + |
| 178 | + .. attribute:: code |
| 179 | + :type: str |
| 180 | + :value: "GenericError" |
| 181 | + |
| 182 | + .. attribute:: default_description |
| 183 | + :type: str |
| 184 | + :value: "Any other error not all other OCPP defined errors" |
| 185 | + |
| 186 | +.. exception:: ValidationError |
| 187 | + |
| 188 | + Raised when validation of a message payload fails. This is not an official OCPP error. |
| 189 | + |
| 190 | +.. exception:: UnknownCallErrorCodeError |
| 191 | + |
| 192 | + Raised when a CallError is received with an unknown error code. |
0 commit comments