Source code for oldman.exception

# Abstract types

[docs]class OMError(Exception): """Root of exceptions generated by the oldman package expected HTTP ones.""" pass
[docs]class ModelGenerationError(OMError): """Error when generating a new model.""" pass
[docs]class OMRuntimeError(OMError): """Error at runtime after the initialization. """ #---------------------- # Main exception types #----------------------
[docs]class OMSchemaError(ModelGenerationError): """Error in the schema graph and/or the JSON-LD context.""" pass
[docs]class OMUserError(OMRuntimeError): """Error when accessing or editing objects.""" pass
[docs]class OMDataStoreError(OMRuntimeError): """Error detected in the stored data.""" pass
[docs]class OMInternalError(OMError): """ Do not expect it. """ pass #------------------------------ # Controller (HTTP) exceptions #------------------------------
[docs]class OMControllerException(Exception): """TODO: describe """ pass
[docs]class OMBadRequestException(OMControllerException): """TODO: describe Error: 400 """
[docs]class OMForbiddenOperationException(OMControllerException): """ No chance TODO: improve """ pass
[docs]class OMRequiredAuthenticationException(OMControllerException): """ Try again TODO: improve """ pass
[docs]class OMResourceNotFoundException(OMControllerException): """ TODO: describe """ pass
[docs]class OMMethodNotAllowedException(OMControllerException): """ 405 """ pass
[docs]class OMNotAcceptableException(OMControllerException): """ 406 Not Acceptable TODO: indicate the content-type """ pass #--------------------------------------------------------------------- # Pedantic exceptions # For clarity # No need to except them in a programmatic manner, prefer generic exceptions #---------------------------------------------------------------------
[docs]class AlreadyAllocatedModelError(ModelGenerationError): """The class IRI or the short name of a new model is already allocated.""" pass
[docs]class OMPropertyDefError(OMSchemaError): """Inconsistency in the definition of a supported property.""" pass
[docs]class OMPropertyDefTypeError(OMPropertyDefError): """A RDF property cannot be both an ObjectProperty and a DatatypeProperty.""" pass
[docs]class OMAttributeDefError(OMSchemaError): """Inconsistency in the definition of a model class attribute.""" pass
[docs]class OMAlreadyDeclaredDatatypeError(OMAttributeDefError): """At least two different datatypes for the same attribute. You may check the possible datatype inherited from the property (rdfs:range) and the one specified in the JSON-LD context. """ pass
[docs]class OMReservedAttributeNameError(OMAttributeDefError): """Some attribute names are reserved and should not be included in the JSON-LD context.""" pass
[docs]class OMUndeclaredClassNameError(ModelGenerationError): """The name of the model class should be defined in the JSON-LD context.""" pass
[docs]class OMExpiredMethodDeclarationTimeSlotError(ModelGenerationError): """All methods must be declared before creating a first model.""" pass
[docs]class OMEditError(OMUserError): """Runtime errors, occuring when editing or creating an object.""" pass
[docs]class OMAttributeTypeCheckError(OMEditError): """The value assigned to the attribute has wrong type.""" pass
[docs]class OMRequiredPropertyError(OMEditError): """A required property has no value.""" pass
[docs]class OMReadOnlyAttributeError(OMEditError): """End-users are not allowed to edit this attribute.""" pass
[docs]class OMUniquenessError(OMEditError): """Attribute uniqueness violation. Example: IRI illegal reusing. """ pass
[docs]class OMWrongResourceError(OMEditError): """Not updating the right object.""" pass
[docs]class OMDifferentHashlessIRIError(OMEditError): """When creating or updating an object with a different hashless IRI is forbidden. Blank nodes are not concerned. """ pass
[docs]class OMForbiddenSkolemizedIRIError(OMEditError): """When updating a skolemized IRI from the local domain is forbidden.""" pass
[docs]class OMRequiredHashlessIRIError(OMEditError): """No hash-less IRI has been given.""" pass
[docs]class OMUnauthorizedTypeChangeError(OMEditError): """When updating a resource with new types without explicit authorization.""" pass
[docs]class OMAccessError(OMUserError): """Error when accessing objects.""" pass
[docs]class OMAttributeAccessError(OMAccessError): """When such an attribute cannot be identified (is not supported or no model has been found). """ pass
[docs]class OMClassInstanceError(OMAccessError): """The object is not an instance of the expected RDFS class.""" pass
[docs]class OMObjectNotFoundError(OMAccessError): """When the object is not found.""" pass
[docs]class OMHashIriError(OMAccessError): """A hash IRI has been given instead of a hash-less IRI.""" pass
[docs]class OMSPARQLError(OMAccessError): """Invalid SPARQL query given.""" pass
[docs]class OMSPARQLParseError(OMInternalError): """Invalid SPARQL request.""" pass
[docs]class OMAlreadyGeneratedAttributeError(OMInternalError): """Attribute generation occurs only once per SupportedProperty. You should not try to add metadata or regenerate after that. """ pass
[docs]class UnsupportedDataStorageFeatureException(OMDataStoreError): """Feature not supported by the data store."""