Exceptions¶
All Saffier custom exceptions derive from the base SaffierException.
ObjectNotFound¶
Raised when querying a model instance and it does not exist.
from saffier.exceptions import ObjectNotFound
Or simply:
from saffier import ObjectNotFound
MultipleObjectsReturned¶
Raised when querying a model and returns multiple results for the given query result.
from saffier.exceptions import MultipleObjectsReturned
Or simply:
from saffier import MultipleObjectsReturned
ValidationError¶
Raised when a validation error is thrown.
from saffier.exceptions import ValidationError
Or simply:
from saffier import ValidationError
ImproperlyConfigured¶
Raised when misconfiguration in the models and metaclass is passed.
from saffier.exceptions import ImproperlyConfigured
Or simply:
from saffier import ImproperlyConfigured
MarshallFieldDefinitionError¶
Raised when a marshall declaration is incomplete or inconsistent.
Examples:
- missing
marshall_config - using both
fieldsandexclude - forgetting
ClassVaronmarshall_config - declaring a
MarshallMethodFieldwithout its matchingget_<field>()
from saffier.exceptions import MarshallFieldDefinitionError
SuspiciousFileOperation¶
Raised when file/path utilities detect an unsafe filename or path traversal.
from saffier.exceptions import SuspiciousFileOperation
FileOperationError¶
Raised when a file operation cannot be completed safely.
from saffier.exceptions import FileOperationError
InvalidStorageError¶
Raised when a configured storage alias or backend cannot be loaded.
from saffier.exceptions import InvalidStorageError
DatabaseNotConnectedWarning¶
Warning category for operations that require a connected database but run disconnected.
from saffier.exceptions import DatabaseNotConnectedWarning