linkahead.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 linkahead.exceptions.AmbiguousEntityError(error=None, entity=None)#

Bases: EntityError

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

exception linkahead.exceptions.AuthorizationError(error=None, entity=None)#

Bases: EntityError

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

Maybe you need more privileges or a user account.

exception linkahead.exceptions.BadQueryError(msg)#

Bases: LinkAheadException

Base class for errors raised when a query could not be processed by the server, for example due to incorrect query syntax, or if the query results do not match the expected return.

exception linkahead.exceptions.CaosDBConnectionError(msg=None)#

Bases: LinkAheadException

exception linkahead.exceptions.CaosDBException(msg)#

Bases: Exception

exception linkahead.exceptions.ConfigurationError(msg)#

Bases: LinkAheadException

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 linkahead.exceptions.ConsistencyError(error=None, entity=None)#

Bases: EntityError

The transaction violates database consistency.

exception linkahead.exceptions.EmptyUniqueQueryError(msg)#

Bases: BadQueryError

Raised if a unique query found no result.

exception linkahead.exceptions.EntityDoesNotExistError(error=None, entity=None)#

Bases: EntityError

This entity does not exist.

exception linkahead.exceptions.EntityError(error=None, entity=None)#

Bases: TransactionError

Base class for transaction errors related to an entity. EntityErrors are collected by the TransactionError during whose transaction they were encountered, and are never raised directly.

If this EntityError was caused by other entities, for example an incomplete property, the corresponding EntityErrors are added to this EntityError, so it also functions in the same was as a base TransactionError.

entity#

The entity which caused this error.

Type:

Entity

msg#

The error message returned by the server.

Type:

str

property description#

The description of the error.

exception linkahead.exceptions.EntityHasNoAclError(error=None, entity=None)#

Bases: EntityError

This entity has no ACL (yet).

exception linkahead.exceptions.EntityHasNoDatatypeError(error=None, entity=None)#

Bases: EntityError

This has to have a data type.

exception linkahead.exceptions.HTTPClientError(msg, status, body)#

Bases: LinkAheadException

Raised if a connection returns 4xx HTTP client errors. Likely indicates connection problems caused by the Python client.

exception linkahead.exceptions.HTTPForbiddenError(msg=None)#

Bases: HTTPClientError

You’re lacking the required permissions and are not allowed to access the requested resource. Corresponds to HTTP status 403.

exception linkahead.exceptions.HTTPResourceNotFoundError(msg=None)#

Bases: HTTPClientError

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

exception linkahead.exceptions.HTTPServerError(body)#

Bases: LinkAheadException

Raised if a connection returns 5xx HTTP server errors. Likely indicates connection problems caused by the LinkAhead server.

exception linkahead.exceptions.HTTPURITooLongError(msg=None)#

Bases: HTTPClientError

The URI of the request was too long to be processed by the server.

exception linkahead.exceptions.LinkAheadConnectionError(msg=None)#

Bases: CaosDBConnectionError

Connection is not configured or the network is down.

exception linkahead.exceptions.LinkAheadException(msg)#

Bases: CaosDBException

Base class of all LinkAhead exceptions.

exception linkahead.exceptions.LoginFailedError(msg=None)#

Bases: LinkAheadException

Login failed.

Probably, your username/password pair is wrong.

exception linkahead.exceptions.MismatchingEntitiesError(msg)#

Bases: LinkAheadException

Mismatching entities were found during container sync.

exception linkahead.exceptions.PagingConsistencyError(msg)#

Bases: BadQueryError

Raised if the database state changed between two consecutive paged requests of the same query.

exception linkahead.exceptions.QueryNotUniqueError(msg)#

Bases: BadQueryError

Raised if a unique query was ambiguous and found more than one entity.

exception linkahead.exceptions.ServerConfigurationException(msg)#

Bases: LinkAheadException

The server is configured in a different way than expected.

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

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

Bases: LinkAheadException

A TransactionError is raised whenever a transaction to the server (insert, update, retrieve, or delete) fails, and collects all errors encountered in this transaction. The details of these encountered errors are contained in EntityErrors, which are linked in the ‘errors’ and ‘all_errors’ attributes. The string method of TransactionError returns a tree-like representation of all errors.

entities#

Contains all Entities that directly caused at least one error in this transaction.

Type:

list[Entity]

errors#

Contains all EntityErrors which directly caused the transaction to fail.

Type:

list[EntityError]

all_entities#

Contains all Entities that directly or indirectly caused either this TransactionError or any of the EntityErrors it contains.

Type:

set[Entity]

all_errors#

Contains all EntityErrors which directly or indirectly caused the transaction to fail.

Type:

set[EntityError]

add_error(error)#

Add an error as a direct child to this TransactionError.

Parameters:

error (EntityError or iterable of EntityError) – An EntityError or a list of EntityError instances.

Raises:

TypeError – If and only if error is not an instance of EntityError.

Returns:

self.

Return type:

TransactionError

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 linkahead.exceptions.UniqueNamesError(error=None, entity=None)#

Bases: EntityError

A name was supposed to be unique but was not.

exception linkahead.exceptions.UnqualifiedParentsError(error=None, entity=None)#

Bases: 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 linkahead.exceptions.UnqualifiedPropertiesError(error=None, entity=None)#

Bases: 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).