Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed789f9

Browse files
committed
Issue #6057: Document exceptions in sqlite3 module
Patch by Jaysinh Shukla and Stéphane Wirtel.
1 parent 48de282 commit ed789f9

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

Doc/library/sqlite3.rst

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ Cursor Objects
542542
.. literalinclude:: ../includes/sqlite3/execute_1.py
543543

544544
:meth:`execute` will only execute a single SQL statement. If you try to execute
545-
more than one statement with it, it will raise an ``sqlite3.Warning``. Use
545+
more than one statement with it, it will raise an :exc:`.Warning`. Use
546546
:meth:`executescript` if you want to execute multiple SQL statements with one
547547
call.
548548

@@ -605,7 +605,7 @@ Cursor Objects
605605

606606
Close the cursor now (rather than whenever ``__del__`` is called).
607607

608-
The cursor will be unusable from this point forward; a ``ProgrammingError``
608+
The cursor will be unusable from this point forward; a :exc:`ProgrammingError`
609609
exception will be raised if any operation is attempted with the cursor.
610610

611611
.. attribute:: rowcount
@@ -719,6 +719,36 @@ Now we plug :class:`Row` in::
719719
35.14
720720

721721

722+
.. _sqlite3-exceptions:
723+
724+
Exceptions
725+
----------
726+
727+
.. exception:: Warning
728+
729+
A subclass of :exc:`Exception`.
730+
731+
.. exception:: Error
732+
733+
The base class of the other exceptions in this module. It is a subclass
734+
of :exc:`Exception`.
735+
736+
.. exception:: DatabaseError
737+
738+
Exception raised for errors that are related to the database.
739+
740+
.. exception:: IntegrityError
741+
742+
Exception raised when the relational integrity of the database is affected,
743+
e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`.
744+
745+
.. exception:: ProgrammingError
746+
747+
Exception raised for programming errors, e.g. table not found or already
748+
exists, syntax error in the SQL statement, wrong number of parameters
749+
specified, etc. It is a subclass of :exc:`DatabaseError`.
750+
751+
722752
.. _sqlite3-types:
723753

724754
SQLite and Python types

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ Shiyao Ma
13601360
Alex Shkop
13611361
Joel Shprentz
13621362
Yue Shuaijie
1363+
Jaysinh Shukla
13631364
Terrel Shumway
13641365
Eric Siegerman
13651366
Paul Sijben

0 commit comments

Comments
 (0)