]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Make the DBAPI errors appear defined in the psycopg3 module
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 28 Feb 2021 02:17:54 +0000 (03:17 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 28 Feb 2021 13:06:53 +0000 (14:06 +0100)
psycopg3/psycopg3/errors.py

index cff4a22f9a7343d2993ed84f654bae98e63ffd82..5e170d5187cd7ca9dd4cc5689f41f0c002b76f44 100644 (file)
@@ -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."""