From: Daniele Varrazzo Date: Sun, 28 Feb 2021 02:17:54 +0000 (+0100) Subject: Make the DBAPI errors appear defined in the psycopg3 module X-Git-Tag: 3.0.dev0~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d36ea341ef144a67cb463e24c9471d67a0483a3e;p=thirdparty%2Fpsycopg.git Make the DBAPI errors appear defined in the psycopg3 module --- diff --git a/psycopg3/psycopg3/errors.py b/psycopg3/psycopg3/errors.py index cff4a22f9..5e170d518 100644 --- a/psycopg3/psycopg3/errors.py +++ b/psycopg3/psycopg3/errors.py @@ -31,6 +31,8 @@ class Warning(Exception): Defined for DBAPI compatibility, but never raised by ``psycopg3``. """ + __module__ = "psycopg3" + ErrorInfo = Union[None, PGresult, Dict[int, Optional[bytes]]] @@ -45,6 +47,8 @@ class Error(Exception): This exception is guaranteed to be picklable. """ + __module__ = "psycopg3" + def __init__( self, *args: Sequence[Any], @@ -87,12 +91,16 @@ class InterfaceError(Error): An error related to the database interface rather than the database itself. """ + __module__ = "psycopg3" + class DatabaseError(Error): """ Exception raised for errors that are related to the database. """ + __module__ = "psycopg3" + class DataError(DatabaseError): """ @@ -101,6 +109,8 @@ class DataError(DatabaseError): Examples may be division by zero, numeric value out of range, etc. """ + __module__ = "psycopg3" + class OperationalError(DatabaseError): """ @@ -112,6 +122,8 @@ class OperationalError(DatabaseError): during processing, etc. """ + __module__ = "psycopg3" + class IntegrityError(DatabaseError): """ @@ -120,6 +132,8 @@ class IntegrityError(DatabaseError): An example may be a foreign key check failed. """ + __module__ = "psycopg3" + class InternalError(DatabaseError): """ @@ -129,6 +143,8 @@ class InternalError(DatabaseError): of sync, etc. """ + __module__ = "psycopg3" + class ProgrammingError(DatabaseError): """ @@ -138,12 +154,16 @@ class ProgrammingError(DatabaseError): statement, wrong number of parameters specified, etc. """ + __module__ = "psycopg3" + class NotSupportedError(DatabaseError): """ A method or database API was used which is not supported by the database, """ + __module__ = "psycopg3" + class Diagnostic: """Details from a database error report."""