Skip to content

Exceptions

Server errors are classed by their SQLSTATE, as Errors explains; errors of the driver itself carry the code 0.

Exception
├── Warning
└── Error
    ├── InterfaceError
    └── DatabaseError
        ├── DataError
        │   └── OutOfRangeError  (also an OperationalError)
        ├── OperationalError
        │   └── PoolTimeout
        ├── IntegrityError
        ├── InternalError
        ├── ProgrammingError
        └── NotSupportedError

They are importable from rustmy, rustmy.err and rustmy.aio, and are attributes of every connection (conn.ProgrammingError), as PEP 249 suggests.

PEP 249 exceptions.

They are defined in the native module (so Rust can raise them without importing Python code) and re-exported here. Every exception carries (code, message) as its args.

PoolTimeout is rustmy's own, raised by the pools.

OutOfRangeError (server error 1690, a numeric value out of range) is both a DataError, as its SQLSTATE says, and an OperationalError, as mysqlclient raises it: Django turns that one into an IntegrityError.

Error

Bases: Exception

Warning

Bases: Exception

InterfaceError

Bases: Error

DatabaseError

Bases: Error

DataError

Bases: DatabaseError

OperationalError

Bases: DatabaseError

IntegrityError

Bases: DatabaseError

InternalError

Bases: DatabaseError

ProgrammingError

Bases: DatabaseError

NotSupportedError

Bases: DatabaseError

OutOfRangeError

PoolTimeout

Bases: OperationalError

No connection of a pool came free in time (acquire(timeout=…)).