Package exceptions
source code
All MySQL exceptions.
This package contains all exceptions for the MySQL library. All exceptions
from the submodules are imported into the top-level of this package so you do
not need to import any of the specific submodules.
There is a base exception Error for all exceptions.
There is generally two types of exceptions. The ones that derive from
MySQL_Error are the ones that have a MySQL error code and are probably
generated by MySQL itself. The others do not derive from MySQL_Error and are
generated by this Python library (these can be found in the
mysql.exceptions.internal module).
All errors that MySQL can generate have been given their own exception object.
These are generally the error code from the C library converted to bumpy case
with a few underscores added here and there to make them slightly more
readable.
Note that the MySQL API is somewhat inconsistent in its naming convention.
Sometimes the error code ends with _ERROR and sometimes it doesn't.
Although I'm tempted to normalize the naming scheme, I figure it might make
issues more confusing.
A modest attempt has been made to include the potential exceptions that might
be risen by various methods throughout this Python library in the docstrings.
This is mainly based on the MySQL documentation. However, it is very far from
complete. Particularly, errors that are risen from the server side (those found
in mysql.exceptions.server) are generally not addressed at all in the
docstrings. This would be a monumental task to try to identify them all and
properly document them. It also might create too much noise, because many of
the server-side errors are not ones you would normally bother to catch.