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.
3
10
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 ):
5
66
"""Base error for all Connection Pool errors."""
6
67
7
68
class ConnectionPoolBuildError (BaseConnectionPoolError ):
@@ -13,7 +74,7 @@ class ConnectionPoolConfigurationError(BaseConnectionPoolError):
13
74
class ConnectionPoolExecuteError (BaseConnectionPoolError ):
14
75
"""Error in connection pool execution."""
15
76
16
- class BaseConnectionError (RustPSQLDriverPyBaseError ):
77
+ class BaseConnectionError (InterfaceError ):
17
78
"""Base error for Connection errors."""
18
79
19
80
class ConnectionExecuteError (BaseConnectionError ):
@@ -22,7 +83,7 @@ class ConnectionExecuteError(BaseConnectionError):
22
83
class ConnectionClosedError (BaseConnectionError ):
23
84
"""Error if underlying connection is already closed."""
24
85
25
- class BaseTransactionError (RustPSQLDriverPyBaseError ):
86
+ class BaseTransactionError (InterfaceError ):
26
87
"""Base error for all transaction errors."""
27
88
28
89
class TransactionBeginError (BaseTransactionError ):
@@ -43,7 +104,7 @@ class TransactionExecuteError(BaseTransactionError):
43
104
class TransactionClosedError (BaseTransactionError ):
44
105
"""Error if underlying connection is already closed."""
45
106
46
- class BaseCursorError (RustPSQLDriverPyBaseError ):
107
+ class BaseCursorError (InterfaceError ):
47
108
"""Base error for Cursor errors."""
48
109
49
110
class CursorStartError (BaseCursorError ):
@@ -58,29 +119,27 @@ class CursorFetchError(BaseCursorError):
58
119
class CursorClosedError (BaseCursorError ):
59
120
"""Error if underlying connection is already closed."""
60
121
61
- class UUIDValueConvertError (RustPSQLDriverPyBaseError ):
122
+ class UUIDValueConvertError (DataError ):
62
123
"""Error if it's impossible to convert py string UUID into rust UUID."""
63
124
64
- class MacAddrConversionError (RustPSQLDriverPyBaseError ):
125
+ class MacAddrConversionError (DataError ):
65
126
"""Error if cannot convert MacAddr string value to rust type."""
66
127
67
- class RustToPyValueMappingError (RustPSQLDriverPyBaseError ):
128
+ class RustToPyValueMappingError (DataError ):
68
129
"""Error if it is not possible to covert rust type to python.
69
130
70
131
You can get it if you database contains data type that it not
71
132
supported by this library.
72
-
73
- It's better to handle this exception.
74
133
"""
75
134
76
- class PyToRustValueMappingError (RustPSQLDriverPyBaseError ):
135
+ class PyToRustValueMappingError (DataError ):
77
136
"""Error if it is not possible to covert python type to rust.
78
137
79
138
You can get this exception when executing queries with parameters.
80
139
So, if there are no parameters for the query, don't handle this error.
81
140
"""
82
141
83
- class BaseListenerError (RustPSQLDriverPyBaseError ):
142
+ class BaseListenerError (InterfaceError ):
84
143
"""Base error for all Listener errors."""
85
144
86
145
class ListenerStartError (BaseListenerError ):
0 commit comments