Source code for arangoasync.exceptions

from typing import Optional

from arangoasync.request import Request
from arangoasync.response import Response


[docs] class ArangoError(Exception): """Base class for all exceptions in python-arango-async."""
[docs] class ArangoClientError(ArangoError): """Base class for all client-related exceptions. Args: msg (str): Error message. Attributes: source (str): Source of the error (always set to "client") message (str): Error message. """ source = "client" def __init__(self, msg: str) -> None: super().__init__(msg) self.message = msg
[docs] class ArangoServerError(ArangoError): """Base class for all server-related exceptions. Args: resp (Response): HTTP response object. request (Request): HTTP request object. msg (str | None): Error message. Attributes: source (str): Source of the error (always set to "server") message (str): Error message. url (str): URL of the request. response (Response): HTTP response object. request (Request): HTTP request object. http_method (str): HTTP method of the request. http_code (int): HTTP status code of the response. http_headers (dict): HTTP headers of the response. """ source = "server" def __init__( self, resp: Response, request: Request, msg: Optional[str] = None ) -> None: if msg is None: msg = resp.error_message or resp.status_text else: msg = f"{msg} ({resp.error_message or resp.status_text})" self.error_message = resp.error_message self.error_code = resp.error_code if self.error_code is not None: msg = f"[HTTP {resp.status_code}][ERR {self.error_code}] {msg}" else: msg = f"[HTTP {resp.status_code}] {msg}" self.error_code = resp.status_code super().__init__(msg) self.message = msg self.url = resp.url self.response = resp self.request = request self.http_method = resp.method.name self.http_code = resp.status_code self.http_headers = resp.headers
[docs] class AQLCacheClearError(ArangoServerError): """Failed to clear the query cache."""
[docs] class AQLCacheConfigureError(ArangoServerError): """Failed to configure query cache properties."""
[docs] class AQLCacheEntriesError(ArangoServerError): """Failed to retrieve AQL cache entries."""
[docs] class AQLCachePropertiesError(ArangoServerError): """Failed to retrieve query cache properties."""
[docs] class AQLFunctionCreateError(ArangoServerError): """Failed to create AQL user function."""
[docs] class AQLFunctionDeleteError(ArangoServerError): """Failed to delete AQL user function."""
[docs] class AQLFunctionListError(ArangoServerError): """Failed to retrieve AQL user functions."""
[docs] class AQLQueryClearError(ArangoServerError): """Failed to clear slow AQL queries."""
[docs] class AQLQueryExecuteError(ArangoServerError): """Failed to execute query."""
[docs] class AQLQueryExplainError(ArangoServerError): """Failed to parse and explain query."""
[docs] class AQLQueryHistoryError(ArangoServerError): """Failed to retrieve running AQL queries."""
[docs] class AQLQueryKillError(ArangoServerError): """Failed to kill the query."""
[docs] class AQLQueryListError(ArangoServerError): """Failed to retrieve running AQL queries."""
[docs] class AQLQueryRulesGetError(ArangoServerError): """Failed to retrieve AQL query rules."""
[docs] class AQLQueryTrackingGetError(ArangoServerError): """Failed to retrieve AQL tracking properties."""
[docs] class AQLQueryTrackingSetError(ArangoServerError): """Failed to configure AQL tracking properties."""
[docs] class AQLQueryValidateError(ArangoServerError): """Failed to parse and validate query."""
[docs] class AccessTokenCreateError(ArangoServerError): """Failed to create an access token."""
[docs] class AccessTokenDeleteError(ArangoServerError): """Failed to delete an access token."""
[docs] class AccessTokenListError(ArangoServerError): """Failed to retrieve access tokens."""
[docs] class AnalyzerCreateError(ArangoServerError): """Failed to create analyzer."""
[docs] class AnalyzerGetError(ArangoServerError): """Failed to retrieve analyzer details."""
[docs] class AnalyzerDeleteError(ArangoServerError): """Failed to delete analyzer."""
[docs] class AnalyzerListError(ArangoServerError): """Failed to retrieve analyzers."""
[docs] class AsyncExecuteError(ArangoServerError): """Failed to execute async API request."""
[docs] class AsyncJobCancelError(ArangoServerError): """Failed to cancel async job."""
[docs] class AsyncJobClearError(ArangoServerError): """Failed to clear async job results."""
[docs] class AsyncJobListError(ArangoServerError): """Failed to retrieve async jobs."""
[docs] class AsyncJobResultError(ArangoServerError): """Failed to retrieve async job result."""
[docs] class AsyncJobStatusError(ArangoServerError): """Failed to retrieve async job status."""
[docs] class AuthHeaderError(ArangoClientError): """The authentication header could not be determined."""
[docs] class BackupCreateError(ArangoServerError): """Failed to create a backup."""
[docs] class BackupDeleteError(ArangoServerError): """Failed to delete a backup."""
[docs] class BackupDownloadError(ArangoServerError): """Failed to download a backup from remote repository."""
[docs] class BackupGetError(ArangoServerError): """Failed to retrieve backup details."""
[docs] class BackupRestoreError(ArangoServerError): """Failed to restore from backup."""
[docs] class BackupUploadError(ArangoServerError): """Failed to upload a backup to remote repository."""
[docs] class CollectionCreateError(ArangoServerError): """Failed to create collection."""
[docs] class CollectionChecksumError(ArangoServerError): """Failed to retrieve collection checksum."""
[docs] class CollectionConfigureError(ArangoServerError): """Failed to configure collection properties."""
[docs] class CollectionCompactError(ArangoServerError): """Failed to compact collection."""
[docs] class CollectionDeleteError(ArangoServerError): """Failed to delete collection."""
[docs] class CollectionKeyGeneratorsError(ArangoServerError): """Failed to retrieve key generators."""
[docs] class CollectionListError(ArangoServerError): """Failed to retrieve collections."""
[docs] class CollectionPropertiesError(ArangoServerError): """Failed to retrieve collection properties."""
[docs] class CollectionRecalculateCountError(ArangoServerError): """Failed to recalculate document count."""
[docs] class CollectionRenameError(ArangoServerError): """Failed to rename collection."""
[docs] class CollectionResponsibleShardError(ArangoServerError): """Failed to retrieve responsible shard."""
[docs] class CollectionRevisionError(ArangoServerError): """Failed to retrieve collection revision."""
[docs] class CollectionShardsError(ArangoServerError): """Failed to retrieve collection shards."""
[docs] class CollectionStatisticsError(ArangoServerError): """Failed to retrieve collection statistics."""
[docs] class CollectionTruncateError(ArangoServerError): """Failed to truncate collection."""
[docs] class ClientConnectionAbortedError(ArangoClientError): """The connection was aborted."""
[docs] class ClientConnectionError(ArangoClientError): """The request was unable to reach the server."""
[docs] class ClusterEndpointsError(ArangoServerError): """Failed to retrieve coordinator endpoints."""
[docs] class ClusterHealthError(ArangoServerError): """Failed to retrieve cluster health."""
[docs] class ClusterMaintenanceModeError(ArangoServerError): """Failed to enable/disable cluster supervision maintenance mode."""
[docs] class ClusterRebalanceError(ArangoServerError): """Failed to execute cluster rebalancing operation."""
[docs] class ClusterServerRoleError(ArangoServerError): """Failed to retrieve server role in a cluster."""
[docs] class ClusterServerIDError(ArangoServerError): """Failed to retrieve server ID."""
[docs] class ClusterStatisticsError(ArangoServerError): """Failed to retrieve DB-Server statistics."""
[docs] class CursorCloseError(ArangoServerError): """Failed to delete the cursor result from server."""
[docs] class CursorCountError(ArangoClientError, TypeError): """The cursor count was not enabled."""
[docs] class CursorEmptyError(ArangoClientError): """The current batch in cursor was empty."""
[docs] class CursorNextError(ArangoServerError): """Failed to retrieve the next result batch from server."""
[docs] class CursorStateError(ArangoClientError): """The cursor object was in a bad state."""
[docs] class DatabaseCompactError(ArangoServerError): """Failed to compact databases."""
[docs] class DatabaseCreateError(ArangoServerError): """Failed to create database."""
[docs] class DatabaseDeleteError(ArangoServerError): """Failed to delete database."""
[docs] class DatabaseListError(ArangoServerError): """Failed to retrieve databases."""
[docs] class DatabasePropertiesError(ArangoServerError): """Failed to retrieve database properties."""
[docs] class DatabaseSupportInfoError(ArangoServerError): """Failed to retrieve support info for deployment."""
[docs] class DeserializationError(ArangoClientError): """Failed to deserialize the server response."""
[docs] class DocumentCountError(ArangoServerError): """Failed to retrieve document count."""
[docs] class DocumentDeleteError(ArangoServerError): """Failed to delete document."""
[docs] class DocumentGetError(ArangoServerError): """Failed to retrieve document."""
[docs] class DocumentInsertError(ArangoServerError): """Failed to insert document."""
[docs] class DocumentParseError(ArangoClientError): """Failed to parse document input."""
[docs] class DocumentReplaceError(ArangoServerError): """Failed to replace document."""
[docs] class DocumentRevisionError(ArangoServerError): """The expected and actual document revisions mismatched."""
[docs] class DocumentUpdateError(ArangoServerError): """Failed to update document."""
[docs] class EdgeCollectionListError(ArangoServerError): """Failed to retrieve edge collections."""
[docs] class EdgeDefinitionListError(ArangoServerError): """Failed to retrieve edge definitions."""
[docs] class EdgeDefinitionCreateError(ArangoServerError): """Failed to create edge definition."""
[docs] class EdgeDefinitionReplaceError(ArangoServerError): """Failed to replace edge definition."""
[docs] class EdgeDefinitionDeleteError(ArangoServerError): """Failed to delete edge definition."""
[docs] class EdgeListError(ArangoServerError): """Failed to retrieve edges coming in and out of a vertex."""
[docs] class FoxxConfigGetError(ArangoServerError): """Failed to retrieve Foxx service configuration."""
[docs] class FoxxConfigReplaceError(ArangoServerError): """Failed to replace Foxx service configuration."""
[docs] class FoxxConfigUpdateError(ArangoServerError): """Failed to update Foxx service configuration."""
[docs] class FoxxCommitError(ArangoServerError): """Failed to commit local Foxx service state."""
[docs] class FoxxDependencyGetError(ArangoServerError): """Failed to retrieve Foxx service dependencies."""
[docs] class FoxxDependencyReplaceError(ArangoServerError): """Failed to replace Foxx service dependencies."""
[docs] class FoxxDependencyUpdateError(ArangoServerError): """Failed to update Foxx service dependencies."""
[docs] class FoxxScriptListError(ArangoServerError): """Failed to retrieve Foxx service scripts."""
[docs] class FoxxDevModeEnableError(ArangoServerError): """Failed to enable development mode for Foxx service."""
[docs] class FoxxDevModeDisableError(ArangoServerError): """Failed to disable development mode for Foxx service."""
[docs] class FoxxDownloadError(ArangoServerError): """Failed to download Foxx service bundle."""
[docs] class FoxxReadmeGetError(ArangoServerError): """Failed to retrieve Foxx service readme."""
[docs] class FoxxScriptRunError(ArangoServerError): """Failed to run Foxx service script."""
[docs] class FoxxServiceCreateError(ArangoServerError): """Failed to create Foxx service."""
[docs] class FoxxServiceDeleteError(ArangoServerError): """Failed to delete Foxx services."""
[docs] class FoxxServiceGetError(ArangoServerError): """Failed to retrieve Foxx service metadata."""
[docs] class FoxxServiceListError(ArangoServerError): """Failed to retrieve Foxx services."""
[docs] class FoxxServiceReplaceError(ArangoServerError): """Failed to replace Foxx service."""
[docs] class FoxxServiceUpdateError(ArangoServerError): """Failed to update Foxx service."""
[docs] class FoxxSwaggerGetError(ArangoServerError): """Failed to retrieve Foxx service swagger."""
[docs] class FoxxTestRunError(ArangoServerError): """Failed to run Foxx service tests."""
[docs] class GraphCreateError(ArangoServerError): """Failed to create the graph."""
[docs] class GraphDeleteError(ArangoServerError): """Failed to delete the graph."""
[docs] class GraphListError(ArangoServerError): """Failed to retrieve graphs."""
[docs] class GraphPropertiesError(ArangoServerError): """Failed to retrieve graph properties."""
[docs] class IndexCreateError(ArangoServerError): """Failed to create collection index."""
[docs] class IndexDeleteError(ArangoServerError): """Failed to delete collection index."""
[docs] class IndexGetError(ArangoServerError): """Failed to retrieve collection index."""
[docs] class IndexListError(ArangoServerError): """Failed to retrieve collection indexes."""
[docs] class IndexLoadError(ArangoServerError): """Failed to load indexes into memory."""
[docs] class JWTRefreshError(ArangoClientError): """Failed to refresh the JWT token."""
[docs] class JWTSecretListError(ArangoServerError): """Failed to retrieve information on currently loaded JWT secrets."""
[docs] class JWTSecretReloadError(ArangoServerError): """Failed to reload JWT secrets."""
[docs] class PermissionGetError(ArangoServerError): """Failed to retrieve user permission."""
[docs] class PermissionListError(ArangoServerError): """Failed to list user permissions."""
[docs] class PermissionResetError(ArangoServerError): """Failed to reset user permission."""
[docs] class PermissionUpdateError(ArangoServerError): """Failed to update user permission."""
[docs] class ReplicationApplierConfigError(ArangoServerError): """Failed to retrieve replication applier configuration."""
[docs] class ReplicationApplierStateError(ArangoServerError): """Failed to retrieve replication applier state."""
[docs] class ReplicationClusterInventoryError(ArangoServerError): """Failed to retrieve overview of collection and indexes in a cluster."""
[docs] class ReplicationDumpError(ArangoServerError): """Failed to retrieve collection content."""
[docs] class ReplicationInventoryError(ArangoServerError): """Failed to retrieve inventory of collection and indexes."""
[docs] class ReplicationLoggerStateError(ArangoServerError): """Failed to retrieve logger state."""
[docs] class ReplicationServerIDError(ArangoServerError): """Failed to retrieve server ID."""
[docs] class SerializationError(ArangoClientError): """Failed to serialize the request."""
[docs] class ServerApiCallsError(ArangoServerError): """Failed to retrieve the list of recent API calls."""
[docs] class ServerAvailableOptionsGetError(ArangoServerError): """Failed to retrieve available server options."""
[docs] class ServerCheckAvailabilityError(ArangoServerError): """Failed to retrieve server availability mode."""
[docs] class ServerConnectionError(ArangoServerError): """Failed to connect to ArangoDB server."""
[docs] class ServerCurrentOptionsGetError(ArangoServerError): """Failed to retrieve currently-set server options."""
[docs] class ServerEchoError(ArangoServerError): """Failed to retrieve details on last request."""
[docs] class ServerEncryptionError(ArangoServerError): """Failed to reload user-defined encryption keys."""
[docs] class ServerEngineError(ArangoServerError): """Failed to retrieve database engine."""
[docs] class ServerExecuteError(ArangoServerError): """Failed to execute raw JavaScript command."""
[docs] class ServerMetricsError(ArangoServerError): """Failed to retrieve server metrics."""
[docs] class ServerModeError(ArangoServerError): """Failed to retrieve server mode."""
[docs] class ServerModeSetError(ArangoServerError): """Failed to set server mode."""
[docs] class ServerLicenseGetError(ArangoServerError): """Failed to retrieve server license."""
[docs] class ServerLicenseSetError(ArangoServerError): """Failed to set server license."""
[docs] class ServerLogLevelError(ArangoServerError): """Failed to retrieve server log levels."""
[docs] class ServerLogLevelResetError(ArangoServerError): """Failed to reset server log levels."""
[docs] class ServerLogLevelSetError(ArangoServerError): """Failed to set server log levels."""
[docs] class ServerLogSettingError(ArangoServerError): """Failed to retrieve server log settings."""
[docs] class ServerLogSettingSetError(ArangoServerError): """Failed to set server log settings."""
[docs] class ServerReadLogError(ArangoServerError): """Failed to retrieve global log."""
[docs] class ServerReloadRoutingError(ArangoServerError): """Failed to reload routing details."""
[docs] class ServerShutdownError(ArangoServerError): """Failed to initiate shutdown sequence."""
[docs] class ServerShutdownProgressError(ArangoServerError): """Failed to retrieve soft shutdown progress."""
[docs] class ServerStatusError(ArangoServerError): """Failed to retrieve server status."""
[docs] class ServerTLSError(ArangoServerError): """Failed to retrieve TLS data."""
[docs] class ServerTLSReloadError(ArangoServerError): """Failed to reload TLS."""
[docs] class ServerTimeError(ArangoServerError): """Failed to retrieve server system time."""
[docs] class ServerVersionError(ArangoServerError): """Failed to retrieve server version."""
[docs] class SortValidationError(ArangoClientError): """Invalid sort parameters."""
[docs] class TaskCreateError(ArangoServerError): """Failed to create server task."""
[docs] class TaskDeleteError(ArangoServerError): """Failed to delete server task."""
[docs] class TaskGetError(ArangoServerError): """Failed to retrieve server task details."""
[docs] class TaskListError(ArangoServerError): """Failed to retrieve server tasks."""
[docs] class TransactionAbortError(ArangoServerError): """Failed to abort transaction."""
[docs] class TransactionCommitError(ArangoServerError): """Failed to commit transaction."""
[docs] class TransactionExecuteError(ArangoServerError): """Failed to execute JavaScript transaction."""
[docs] class TransactionInitError(ArangoServerError): """Failed to initialize transaction."""
[docs] class TransactionListError(ArangoServerError): """Failed to retrieve transactions."""
[docs] class TransactionStatusError(ArangoServerError): """Failed to retrieve transaction status."""
[docs] class UserCreateError(ArangoServerError): """Failed to create user."""
[docs] class UserDeleteError(ArangoServerError): """Failed to delete user."""
[docs] class UserGetError(ArangoServerError): """Failed to retrieve user details."""
[docs] class UserListError(ArangoServerError): """Failed to retrieve users."""
[docs] class UserReplaceError(ArangoServerError): """Failed to replace user."""
[docs] class UserUpdateError(ArangoServerError): """Failed to update user."""
[docs] class VertexCollectionCreateError(ArangoServerError): """Failed to create vertex collection."""
[docs] class VertexCollectionDeleteError(ArangoServerError): """Failed to delete vertex collection."""
[docs] class VertexCollectionListError(ArangoServerError): """Failed to retrieve vertex collections."""
[docs] class ViewCreateError(ArangoServerError): """Failed to create view."""
[docs] class ViewDeleteError(ArangoServerError): """Failed to delete view."""
[docs] class ViewGetError(ArangoServerError): """Failed to retrieve view details."""
[docs] class ViewListError(ArangoServerError): """Failed to retrieve views."""
[docs] class ViewRenameError(ArangoServerError): """Failed to rename view."""
[docs] class ViewReplaceError(ArangoServerError): """Failed to replace view."""
[docs] class ViewUpdateError(ArangoServerError): """Failed to update view."""