sob.errors
DefinitionExistsError
Bases: Exception
This error is raised when an attempt is made to redefine a singleton class instance.
ValidationError
Bases: Exception
This error is raised when sob.validate encounters extraneous attributes
associated with a model instance, or discovers missing required attributes.
VersionError
Bases: AttributeError
This error is raised when versioning an object fails due to having data which is incompatible with the target version.
DeserializeError
DeserializeError(data: str | bytes, message: str = '')
Bases: ValueError
This error is raised when data is encountered during deserialization which cannot be parsed.
Attributes:
-
data(str | bytes) –The data that could not be parsed.
-
message(str) –Additional information about the error.
Parameters:
-
data(str | bytes) –The data that could not be parsed.
-
message(str, default:'') –An optional message to include with the error.
Source code in src/sob/errors.py
51 52 53 54 55 56 57 58 59 | |
UnmarshalError
UnmarshalError(
message: str | None = None,
data: sob.abc.MarshallableTypes | None = None,
types: (
collections.abc.Iterable[sob.abc.Property | type]
| sob.abc.Types
| None
) = None,
item_types: (
collections.abc.Iterable[sob.abc.Property | type]
| sob.abc.Types
| None
) = None,
value_types: (
collections.abc.Iterable[sob.abc.Property | type]
| sob.abc.Types
| None
) = None,
)
Bases: Exception
This is an error message raised when data cannot be un-marshalled due to not matching metadata specs.
Attributes:
-
message– -
data(sob.abc.MarshallableTypes | None) – -
types(sob.abc.MarshallableTypes | None) – -
item_types(sob.abc.MarshallableTypes | None) – -
value_types(sob.abc.MarshallableTypes | None) –
Source code in src/sob/errors.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
get_exception_text
get_exception_text() -> str
When called within an exception, this function returns a text
representation of the error matching what is found in
traceback.print_exception, but is returned as a string value rather than
printing.
Source code in src/sob/errors.py
143 144 145 146 147 148 149 150 | |
append_exception_text
append_exception_text(
error: Exception, message: str
) -> None
Cause message to be appended to an error's exception text.
Source code in src/sob/errors.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |