How to use the asyncpg.exceptions._base.PostgresError function in asyncpg

To help you get started, we’ve selected a few asyncpg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
sqlstate = '0P000'


class DiagnosticsError(_base.PostgresError):
    sqlstate = '0Z000'


class StackedDiagnosticsAccessedWithoutActiveHandlerError(DiagnosticsError):
    sqlstate = '0Z002'


class CaseNotFoundError(_base.PostgresError):
    sqlstate = '20000'


class CardinalityViolationError(_base.PostgresError):
    sqlstate = '21000'


class DataError(_base.PostgresError):
    sqlstate = '22000'


class ArraySubscriptError(DataError):
    sqlstate = '2202E'


class CharacterNotInRepertoireError(DataError):
    sqlstate = '22021'


class DatetimeFieldOverflowError(DataError):
github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
sqlstate = 'HV00R'


class FDWUnableToCreateExecutionError(FDWError):
    sqlstate = 'HV00L'


class FDWUnableToCreateReplyError(FDWError):
    sqlstate = 'HV00M'


class FDWUnableToEstablishConnectionError(FDWError):
    sqlstate = 'HV00N'


class PLPGSQLError(_base.PostgresError):
    sqlstate = 'P0000'


class RaiseError(PLPGSQLError):
    sqlstate = 'P0001'


class NoDataFoundError(PLPGSQLError):
    sqlstate = 'P0002'


class TooManyRowsError(PLPGSQLError):
    sqlstate = 'P0003'


class AssertError(PLPGSQLError):
github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
sqlstate = '39P03'


class SavepointError(_base.PostgresError):
    sqlstate = '3B000'


class InvalidSavepointSpecificationError(SavepointError):
    sqlstate = '3B001'


class InvalidCatalogNameError(_base.PostgresError):
    sqlstate = '3D000'


class InvalidSchemaNameError(_base.PostgresError):
    sqlstate = '3F000'


class TransactionRollbackError(_base.PostgresError):
    sqlstate = '40000'


class TransactionIntegrityConstraintViolationError(TransactionRollbackError):
    sqlstate = '40002'


class SerializationError(TransactionRollbackError):
    sqlstate = '40001'


class StatementCompletionUnknownError(TransactionRollbackError):
github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
class ModifyingExternalRoutineSQLDataNotPermittedError(ExternalRoutineError):
    sqlstate = '38002'


class ProhibitedExternalRoutineSQLStatementAttemptedError(
        ExternalRoutineError):
    sqlstate = '38003'


class ReadingExternalRoutineSQLDataNotPermittedError(ExternalRoutineError):
    sqlstate = '38004'


class ExternalRoutineInvocationError(_base.PostgresError):
    sqlstate = '39000'


class InvalidSqlstateReturnedError(ExternalRoutineInvocationError):
    sqlstate = '39001'


class NullValueInExternalRoutineNotAllowedError(
        ExternalRoutineInvocationError):
    sqlstate = '39004'


class TriggerProtocolViolatedError(ExternalRoutineInvocationError):
    sqlstate = '39P01'
github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
sqlstate = '58000'


class PostgresIOError(PostgresSystemError):
    sqlstate = '58030'


class UndefinedFileError(PostgresSystemError):
    sqlstate = '58P01'


class DuplicateFileError(PostgresSystemError):
    sqlstate = '58P02'


class SnapshotTooOldError(_base.PostgresError):
    sqlstate = '72000'


class ConfigFileError(_base.PostgresError):
    sqlstate = 'F0000'


class LockFileExistsError(ConfigFileError):
    sqlstate = 'F0001'


class FDWError(_base.PostgresError):
    sqlstate = 'HV000'


class FDWColumnNameNotFoundError(FDWError):
github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
sqlstate = '39P02'


class EventTriggerProtocolViolatedError(ExternalRoutineInvocationError):
    sqlstate = '39P03'


class SavepointError(_base.PostgresError):
    sqlstate = '3B000'


class InvalidSavepointSpecificationError(SavepointError):
    sqlstate = '3B001'


class InvalidCatalogNameError(_base.PostgresError):
    sqlstate = '3D000'


class InvalidSchemaNameError(_base.PostgresError):
    sqlstate = '3F000'


class TransactionRollbackError(_base.PostgresError):
    sqlstate = '40000'


class TransactionIntegrityConstraintViolationError(TransactionRollbackError):
    sqlstate = '40002'


class SerializationError(TransactionRollbackError):
github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
sqlstate = '53100'


class OutOfMemoryError(InsufficientResourcesError):
    sqlstate = '53200'


class TooManyConnectionsError(InsufficientResourcesError):
    sqlstate = '53300'


class ConfigurationLimitExceededError(InsufficientResourcesError):
    sqlstate = '53400'


class ProgramLimitExceededError(_base.PostgresError):
    sqlstate = '54000'


class StatementTooComplexError(ProgramLimitExceededError):
    sqlstate = '54001'


class TooManyColumnsError(ProgramLimitExceededError):
    sqlstate = '54011'


class TooManyArgumentsError(ProgramLimitExceededError):
    sqlstate = '54023'


class ObjectNotInPrerequisiteStateError(_base.PostgresError):
github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
sqlstate = '01P01'


class NoData(PostgresWarning):
    sqlstate = '02000'


class NoAdditionalDynamicResultSetsReturned(NoData):
    sqlstate = '02001'


class SQLStatementNotYetCompleteError(_base.PostgresError):
    sqlstate = '03000'


class PostgresConnectionError(_base.PostgresError):
    sqlstate = '08000'


class ConnectionDoesNotExistError(PostgresConnectionError):
    sqlstate = '08003'


class ConnectionFailureError(PostgresConnectionError):
    sqlstate = '08006'


class ClientCannotConnectError(PostgresConnectionError):
    sqlstate = '08001'


class ConnectionRejectionError(PostgresConnectionError):
github MagicStack / asyncpg / asyncpg / exceptions / _base.py View on Github external
if self.detail:
            msg += '\nDETAIL:  {}'.format(self.detail)
        if self.hint:
            msg += '\nHINT:  {}'.format(self.hint)

        return msg

    @classmethod
    def new(cls, fields, query=None):
        exccls, message, dct = cls._make_constructor(fields, query)
        ex = exccls(message)
        ex.__dict__.update(dct)
        return ex


class FatalPostgresError(PostgresError):
    """A fatal error that should result in server disconnection."""


class UnknownPostgresError(FatalPostgresError):
    """An error with an unknown SQLSTATE code."""


class InterfaceMessage:
    def __init__(self, *, detail=None, hint=None):
        self.detail = detail
        self.hint = hint

    def __str__(self):
        msg = self.args[0]
        if self.detail:
            msg += '\nDETAIL:  {}'.format(self.detail)
github MagicStack / asyncpg / asyncpg / exceptions / __init__.py View on Github external
sqlstate = '2203C'


class TooManyJsonArrayElementsError(DataError):
    sqlstate = '2203D'


class TooManyJsonObjectMembersError(DataError):
    sqlstate = '2203E'


class SQLJsonScalarRequiredError(DataError):
    sqlstate = '2203F'


class IntegrityConstraintViolationError(_base.PostgresError):
    sqlstate = '23000'


class RestrictViolationError(IntegrityConstraintViolationError):
    sqlstate = '23001'


class NotNullViolationError(IntegrityConstraintViolationError):
    sqlstate = '23502'


class ForeignKeyViolationError(IntegrityConstraintViolationError):
    sqlstate = '23503'


class UniqueViolationError(IntegrityConstraintViolationError):