1- class RustPSQLDriverPyBaseError (Exception ):
2- """Base PSQL-Rust-Engine exception."""
1+ class WarningError (Exception ):
2+ """
3+ Exception raised for important warnings
4+ like data truncations while inserting, etc.
5+ """
6+
7+ class Error (Exception ):
8+ """
9+ Exception that is the base class of all other error exceptions.
310
4- class BaseConnectionPoolError (RustPSQLDriverPyBaseError ):
11+ You can use this to catch all errors with one single except statement.
12+ """
13+
14+ class InterfaceError (Error ):
15+ """
16+ Exception raised for errors that are related to the
17+ database interface rather than the database itself.
18+ """
19+
20+ class DatabaseError (Error ):
21+ """Exception raised for errors that are related to the database."""
22+
23+ class DataError (DatabaseError ):
24+ """
25+ Exception raised for errors that are due to problems with
26+ the processed data like division by zero, numeric value out of range, etc.
27+ """
28+
29+ class OperationalError (DatabaseError ):
30+ """
31+ Exception raised for errors that are related to the database’s operation
32+ and not necessarily under the control of the programmer,
33+ e.g. an unexpected disconnect occurs, the data source name is not found,
34+ a transaction could not be processed, a memory allocation error
35+ occurred during processing, etc.
36+ """
37+
38+ class IntegrityError (DatabaseError ):
39+ """
40+ Exception raised when the relational integrity of the
41+ database is affected, e.g. a foreign key check fails.
42+ """
43+
44+ class InternalError (DatabaseError ):
45+ """
46+ Exception raised when the database encounters an internal error,
47+ e.g. the cursor is not valid anymore, the transaction is out of sync, etc.
48+ """
49+
50+ class ProgrammingError (DatabaseError ):
51+ """
52+ Exception raised for programming errors, e.g. table not found or
53+ already exists, syntax error in the SQL statement,
54+ wrong number of parameters specified, etc.
55+ """
56+
57+ class NotSupportedError (DatabaseError ):
58+ """
59+ Exception raised in case a method or database API was used which
60+ is not supported by the database, e.g. requesting a .rollback()
61+ on a connection that does not support transaction
62+ or has transactions turned off.
63+ """
64+
65+ class BaseConnectionPoolError (InterfaceError ):
566 """Base error for all Connection Pool errors."""
667
768class ConnectionPoolBuildError (BaseConnectionPoolError ):
@@ -13,7 +74,7 @@ class ConnectionPoolConfigurationError(BaseConnectionPoolError):
1374class ConnectionPoolExecuteError (BaseConnectionPoolError ):
1475 """Error in connection pool execution."""
1576
16- class BaseConnectionError (RustPSQLDriverPyBaseError ):
77+ class BaseConnectionError (InterfaceError ):
1778 """Base error for Connection errors."""
1879
1980class ConnectionExecuteError (BaseConnectionError ):
@@ -22,7 +83,7 @@ class ConnectionExecuteError(BaseConnectionError):
2283class ConnectionClosedError (BaseConnectionError ):
2384 """Error if underlying connection is already closed."""
2485
25- class BaseTransactionError (RustPSQLDriverPyBaseError ):
86+ class BaseTransactionError (InterfaceError ):
2687 """Base error for all transaction errors."""
2788
2889class TransactionBeginError (BaseTransactionError ):
@@ -43,7 +104,7 @@ class TransactionExecuteError(BaseTransactionError):
43104class TransactionClosedError (BaseTransactionError ):
44105 """Error if underlying connection is already closed."""
45106
46- class BaseCursorError (RustPSQLDriverPyBaseError ):
107+ class BaseCursorError (InterfaceError ):
47108 """Base error for Cursor errors."""
48109
49110class CursorStartError (BaseCursorError ):
@@ -58,29 +119,27 @@ class CursorFetchError(BaseCursorError):
58119class CursorClosedError (BaseCursorError ):
59120 """Error if underlying connection is already closed."""
60121
61- class UUIDValueConvertError (RustPSQLDriverPyBaseError ):
122+ class UUIDValueConvertError (DataError ):
62123 """Error if it's impossible to convert py string UUID into rust UUID."""
63124
64- class MacAddrConversionError (RustPSQLDriverPyBaseError ):
125+ class MacAddrConversionError (DataError ):
65126 """Error if cannot convert MacAddr string value to rust type."""
66127
67- class RustToPyValueMappingError (RustPSQLDriverPyBaseError ):
128+ class RustToPyValueMappingError (DataError ):
68129 """Error if it is not possible to covert rust type to python.
69130
70131 You can get it if you database contains data type that it not
71132 supported by this library.
72-
73- It's better to handle this exception.
74133 """
75134
76- class PyToRustValueMappingError (RustPSQLDriverPyBaseError ):
135+ class PyToRustValueMappingError (DataError ):
77136 """Error if it is not possible to covert python type to rust.
78137
79138 You can get this exception when executing queries with parameters.
80139 So, if there are no parameters for the query, don't handle this error.
81140 """
82141
83- class BaseListenerError (RustPSQLDriverPyBaseError ):
142+ class BaseListenerError (InterfaceError ):
84143 """Base error for all Listener errors."""
85144
86145class ListenerStartError (BaseListenerError ):
0 commit comments