|
4 | 4 | # license that can be found in the LICENSE file or at |
5 | 5 | # https://developers.google.com/open-source/licenses/bsd |
6 | 6 |
|
| 7 | +"""Spanner DB API exceptions.""" |
| 8 | + |
7 | 9 |
|
8 | 10 | class Warning(Exception): |
| 11 | + """Important DB API warning.""" |
| 12 | + |
9 | 13 | pass |
10 | 14 |
|
11 | 15 |
|
12 | 16 | class Error(Exception): |
| 17 | + """The base class for all the DB API exceptions. |
| 18 | +
|
| 19 | + Does not include :class:`Warning`. |
| 20 | + """ |
| 21 | + |
13 | 22 | pass |
14 | 23 |
|
15 | 24 |
|
16 | 25 | class InterfaceError(Error): |
| 26 | + """ |
| 27 | + Error related to the database interface |
| 28 | + rather than the database itself. |
| 29 | + """ |
| 30 | + |
17 | 31 | pass |
18 | 32 |
|
19 | 33 |
|
20 | 34 | class DatabaseError(Error): |
| 35 | + """Error related to the database.""" |
| 36 | + |
21 | 37 | pass |
22 | 38 |
|
23 | 39 |
|
24 | 40 | class DataError(DatabaseError): |
| 41 | + """ |
| 42 | + Error due to problems with the processed data like |
| 43 | + division by zero, numeric value out of range, etc. |
| 44 | + """ |
| 45 | + |
25 | 46 | pass |
26 | 47 |
|
27 | 48 |
|
28 | 49 | class OperationalError(DatabaseError): |
| 50 | + """ |
| 51 | + Error related to the database's operation, e.g. an |
| 52 | + unexpected disconnect, the data source name is not |
| 53 | + found, a transaction could not be processed, a |
| 54 | + memory allocation error, etc. |
| 55 | + """ |
| 56 | + |
29 | 57 | pass |
30 | 58 |
|
31 | 59 |
|
32 | 60 | class IntegrityError(DatabaseError): |
| 61 | + """ |
| 62 | + Error for cases of relational integrity of the database |
| 63 | + is affected, e.g. a foreign key check fails. |
| 64 | + """ |
| 65 | + |
33 | 66 | pass |
34 | 67 |
|
35 | 68 |
|
36 | 69 | class InternalError(DatabaseError): |
| 70 | + """ |
| 71 | + Internal database error, e.g. the cursor is not valid |
| 72 | + anymore, the transaction is out of sync, etc. |
| 73 | + """ |
| 74 | + |
37 | 75 | pass |
38 | 76 |
|
39 | 77 |
|
40 | 78 | class ProgrammingError(DatabaseError): |
| 79 | + """ |
| 80 | + Programming error, e.g. table not found or already |
| 81 | + exists, syntax error in the SQL statement, wrong |
| 82 | + number of parameters specified, etc. |
| 83 | + """ |
| 84 | + |
41 | 85 | pass |
42 | 86 |
|
43 | 87 |
|
44 | 88 | class NotSupportedError(DatabaseError): |
| 89 | + """ |
| 90 | + Error for case of a method or database API not |
| 91 | + supported by the database was used. |
| 92 | + """ |
| 93 | + |
45 | 94 | pass |
0 commit comments