summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-06-06 01:12:35 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-08-17 02:00:01 +0100
commitce1ac3aea92738d4456733b94caec9da1f41a295 (patch)
treea49f25dd749e2ed2c9ffc35c3f316de78c8664f4 /lib
parent6becf0ef550e8eb0c241c3835b1466eef37b1784 (diff)
downloadpsycopg2-ce1ac3aea92738d4456733b94caec9da1f41a295.tar.gz
Read exceptions to raise from a Python module
Diffstat (limited to 'lib')
-rw-r--r--lib/errors.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/errors.py b/lib/errors.py
new file mode 100644
index 0000000..1e1d8a8
--- /dev/null
+++ b/lib/errors.py
@@ -0,0 +1,16 @@
+"""Error classes for PostgreSQL error codes
+"""
+
+from psycopg2._psycopg import ( # noqa
+ Error, Warning, DataError, DatabaseError, ProgrammingError, IntegrityError,
+ InterfaceError, InternalError, NotSupportedError, OperationalError,
+ QueryCanceledError, TransactionRollbackError)
+
+
+_by_sqlstate = {}
+
+
+class UndefinedTable(ProgrammingError):
+ pass
+
+_by_sqlstate['42P01'] = UndefinedTable