Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.

Commit 5ed0845

Browse files
author
Ilya Gurov
authored
docs: verify and comment the DB API exceptions (#522)
1 parent 62c22b1 commit 5ed0845

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

google/cloud/spanner_dbapi/exceptions.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,91 @@
44
# license that can be found in the LICENSE file or at
55
# https://developers.google.com/open-source/licenses/bsd
66

7+
"""Spanner DB API exceptions."""
8+
79

810
class Warning(Exception):
11+
"""Important DB API warning."""
12+
913
pass
1014

1115

1216
class Error(Exception):
17+
"""The base class for all the DB API exceptions.
18+
19+
Does not include :class:`Warning`.
20+
"""
21+
1322
pass
1423

1524

1625
class InterfaceError(Error):
26+
"""
27+
Error related to the database interface
28+
rather than the database itself.
29+
"""
30+
1731
pass
1832

1933

2034
class DatabaseError(Error):
35+
"""Error related to the database."""
36+
2137
pass
2238

2339

2440
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+
2546
pass
2647

2748

2849
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+
2957
pass
3058

3159

3260
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+
3366
pass
3467

3568

3669
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+
3775
pass
3876

3977

4078
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+
4185
pass
4286

4387

4488
class NotSupportedError(DatabaseError):
89+
"""
90+
Error for case of a method or database API not
91+
supported by the database was used.
92+
"""
93+
4594
pass

0 commit comments

Comments
 (0)