caosdb.exceptions module

The exceptions module defines exceptions for HTTP Errors (4xx and 5xx and HTTP response codes) and for transaction errors (i.e. missing permissions, dependencies, non-passing consistency checks etc.).

exception caosdb.exceptions.AmbiguousEntityError(error=None, entity=None)

Bases: caosdb.exceptions.EntityError

A retrieval of the entity was not possible because there is more than one possible candidate.

exception caosdb.exceptions.AuthorizationError(error=None, entity=None)

Bases: caosdb.exceptions.EntityError

You are not allowed to do what ever you tried to do.

Maybe you need more privileges or a user account.

exception caosdb.exceptions.BadQueryError(msg)

Bases: caosdb.exceptions.CaosDBException

Base class for query errors that are not transaction errors.

exception caosdb.exceptions.CaosDBConnectionError(msg=None)

Bases: caosdb.exceptions.CaosDBException

Connection is not configured or the network is down.

exception caosdb.exceptions.CaosDBException(msg)

Bases: Exception

Base class of all CaosDB exceptions.

exception caosdb.exceptions.ConfigurationError(msg)

Bases: caosdb.exceptions.CaosDBException

ConfigurationError.

Indicates a misconfiguration.

Parameters

msg (str) – A descriptin of the misconfiguration. The constructor adds a few lines with explainingg where to find the configuration.

msg

A description of the misconfiguration.

Type

str

exception caosdb.exceptions.ConsistencyError(error=None, entity=None)

Bases: caosdb.exceptions.EntityError

The transaction violates database consistency.

exception caosdb.exceptions.EmptyUniqueQueryError(msg)

Bases: caosdb.exceptions.BadQueryError

A unique query or retrieve dound no result.

exception caosdb.exceptions.EntityDoesNotExistError(error=None, entity=None)

Bases: caosdb.exceptions.EntityError

This entity does not exist.

exception caosdb.exceptions.EntityError(error=None, entity=None)

Bases: caosdb.exceptions.TransactionError

This is the most basic entity error. It is constructed using an entity that caused the error and the error message attached by the server.

property description

The description of the error.

exception caosdb.exceptions.EntityHasNoDatatypeError(error=None, entity=None)

Bases: caosdb.exceptions.EntityError

This has to have a data type.

exception caosdb.exceptions.HTTPClientError(msg, status, body)

Bases: caosdb.exceptions.CaosDBException

HTTPClientError represents 4xx HTTP client errors.

exception caosdb.exceptions.HTTPForbiddenError(msg=None)

Bases: caosdb.exceptions.HTTPClientError

You’re lacking the required permissions. Corresponds to HTTP status 403.

exception caosdb.exceptions.HTTPResourceNotFoundError(msg=None)

Bases: caosdb.exceptions.HTTPClientError

The requested resource doesn’t exist; corresponds to HTTP status 404.

exception caosdb.exceptions.HTTPServerError(body)

Bases: caosdb.exceptions.CaosDBException

HTTPServerError represents 5xx HTTP server errors.

exception caosdb.exceptions.HTTPURITooLongError(msg=None)

Bases: caosdb.exceptions.HTTPClientError

The URI of the last request was too long.

exception caosdb.exceptions.LoginFailedError(msg=None)

Bases: caosdb.exceptions.CaosDBException

Login failed.

Probably, your username/password pair is wrong.

exception caosdb.exceptions.MismatchingEntitiesError(msg)

Bases: caosdb.exceptions.CaosDBException

Mismatching entities were found during container sync.

exception caosdb.exceptions.QueryNotUniqueError(msg)

Bases: caosdb.exceptions.BadQueryError

A unique query or retrieve found more than one entity.

exception caosdb.exceptions.ServerConfigurationException(msg)

Bases: caosdb.exceptions.CaosDBException

The server is configured in a different way than expected.

This can be for example unexpected flags or settings or missing extensions.

exception caosdb.exceptions.TransactionError(error=None, msg='An error occured during the transaction.', container=None)

Bases: caosdb.exceptions.CaosDBException

An error of this type is raised whenever any transaction fails with one or more entities between client and CaosDB server. More detailed errors are collected as direct and indirect children in the ‘errors’ list (direct children) and the ‘all_errors’ set (set of all direct and indirect children).

add_error(error)

Add an error as a direct child to this TransactionError.

@param error: An EntityError or a list of EntityErrors.

@raise TypeError: If and only if the ‘error’ parameter is not an instance of EntityError.

@return: self.

has_error(error_t, direct_children_only=False)

Check whether this transaction error contains an error of type error_t. If direct_children_only is True, only direct children are checked.

Parameters
  • error_t (EntityError) – error type to be checked

  • direct_children_only (bool, optional) – If True, only direct children, i.e., all errors in self.errors are checked. Else all direct and indirect children, i.e., all errors in self.all_errors are used. Default is false.

Returns

has_error – True if at least one of the children is of type error_t, False otherwise.

Return type

bool

exception caosdb.exceptions.UniqueNamesError(error=None, entity=None)

Bases: caosdb.exceptions.EntityError

A name was supposed to be unique but was not.

exception caosdb.exceptions.UnqualifiedParentsError(error=None, entity=None)

Bases: caosdb.exceptions.EntityError

This entity has unqualified parents (see ‘errors’ attribute for a list of errors of the parent entities or ‘entities’ attribute for a list of parent entities with errors).

exception caosdb.exceptions.UnqualifiedPropertiesError(error=None, entity=None)

Bases: caosdb.exceptions.EntityError

This entity has unqualified properties (see ‘errors’ attribute for a list of errors of the properties or ‘entities’ attribute for a list of properties with errors).