Exceptions¶
Module containing all the exceptions used in Pheres
All exception are subclasses of PheresError, except for PheresInternalError.
This is intended, as PheresInternalError is only raised in case of bugs and
should not be catched. Please make a bug report if you ever encounter PheresInternalError
-
exception
pheres._exceptions.PheresInternalError¶ Bases:
BaseExceptionRaised when pheres encounters an internal error
If you see this exception, please make a bug report
- Variables
msg – explanation of the error
-
exception
pheres._exceptions.PheresError¶ Bases:
ExceptionBase exception in pheres for all other exceptions
-
exception
pheres._exceptions.TypeHintError(type: TypeHint, msg: str = '{type} is not a valid JSON type hint')¶ Bases:
pheres._exceptions.PheresError,TypeErrorRaised for invalid JSON type hints
- Variables
type (TypeHint) – invalid type hint
msg (str) – explanation of the error
-
exception
pheres._exceptions.JSONTypeError(type: TypeHint, value: Any, msg: str = "{value} doesn't have type {type}")¶ Bases:
pheres._exceptions.PheresError,TypeErrorRaised when a value doesn’t have the excepted type
- Variables
type (TypeHint) – expected type
value (Any) – invalid value
msg (str) – explanation of the error
-
exception
pheres._exceptions.JSONValueError(value: Any, msg: str = 'invalid JSON {value}')¶ Bases:
pheres._exceptions.PheresError,ValueErrorRaised when an invalid json value is encountered
- Variables
value (Any) – invalid value
msg (str) – explanation of the error
-
exception
pheres._exceptions.CycleError(obj: Any, cycle: tuple[Any], msg: str = '{obj} contains the cycle {cycle}')¶ Bases:
pheres._exceptions.PheresError,graphlib.CycleErrorRaised when a value has cycles in it
-
exception
pheres._exceptions.JsonableError(msg: str)¶ Bases:
pheres._exceptions.PheresErrorRaised on problems with
@jsonablewhen no better sub-exception exists- Variables
msg (str) – explanation of the error
-
exception
pheres._exceptions.JsonAttrError(cls: str, attr: str, detail: str = '', msg: str = "Error in '{cls}' at attribute '{attr}'{detail}")¶ Bases:
pheres._exceptions.JsonableErrorRaised on problems with
@jsonabledue toJsonAttrwhen no better sub-exception exists
-
exception
pheres._exceptions.JsonAttrValueError(value: Any, cls: str, attr: str, detail: str = '', msg: str = "Invalid JSON value '{value}' in class '{cls}' at attribute '{attr}'")¶ Bases:
pheres._exceptions.JSONValueError,pheres._exceptions.JsonAttrErrorRaised when the default value of a json attribute is not a valid json
-
exception
pheres._exceptions.JsonAttrTypeError(type: TypeHint, value: Any, cls: str, attr: str, detail: str = '', msg: str = "{value} doesn't have type {type} in class '{cls}' at attribute '{attr}'")¶ Bases:
pheres._exceptions.JSONTypeError,pheres._exceptions.JsonAttrErrorRaised when the default value of a json attribute doesn’t have the correct type
- Variables
type – expected type
value – invalid value
msg (str) – explanation of the error
-
exception
pheres._exceptions.DecodeError(msg: str)¶ Bases:
pheres._exceptions.PheresErrorRaised on decoding problem in Pheres when no better exception exists
- Variables
msg (str) – explanation of the error
-
exception
pheres._exceptions.TypedJSONDecodeError(msg, doc, pos)¶ Bases:
json.decoder.JSONDecodeError,pheres._exceptions.DecodeErrorRaised when the decoded type is not the expected one
- Variables
doc (Union[str, JSONType]) – JSON document that contains the error
pos (Union[int, Tuple[str, ..]]) – position of the error in ‘doc’ can be either an string index, or a list of keys in the json
lineno (Optional[int]) – line number of pos
colno (Optional[int]) – column number of pos
msg (str) – explanation of the error