MercurySQL.errors
Here are the exceptions that may be raised by MercurySQL.
Basic Errors
There are many type of errors that can be raised by MercurySQL.
However, all these errors are divided into a few main categories. We have created some Basic Errors that are parent classes of all other errors. So you can catch a whole category of errors by using the parent class.
- class MercurySQL.errors.MercurySQLError
Base class for MercurySQL errors.
- class MercurySQL.errors.MSQLSyntaxError
MSQLSyntaxError is raised when a syntax error is found in the query.
- class MercurySQL.errors.MSQLDriverError
MSQLDriverError is raised when a driver error is found in the query.
Note
If the third-party drivers wants to create there own errors, it is recommended to inherit this class, for better error handling.
Syntax Errors
Syntax Errors are often caused by misusing of MercurySQL’s functions and syntax.
- class MercurySQL.errors.DuplicateError(msg: str)
DuplicateError is raised when a duplicate entry is found in the database.
E.g.: - Trying to create a table with the same name as an existing table. - Trying to add a column with the same name as an existing column.
- class MercurySQL.errors.NotExistsError(msg: str)
NotExistsError is raised when an entry is not found in the database.
E.g.: - Trying to use/delete a table which is not existing. - Trying to use/delete a column which is not existing.
- class MercurySQL.errors.NotSupportedError(msg: str)
NotSupportedError is raised when an operation is not supported by the database.
Currently, this error is not used in MercurySQL.
- class MercurySQL.errors.ConfilictError(msg: str)
ConfilictError is raised when an operation conflicts with the database.
E.g.: - Trying to add a new column, but the column name is already used, and the two columns has different type.
- class MercurySQL.errors.NotSpecifiedError(msg: str)
NotSpecifiedError is raised when a required parameter is not specified.
E.g.: - Trying to create a DataBase object without specifying the driver. - Trying to execute a query without specifying the table.
Driver Errors
Driver Errors are all related to drivers.
A driver can raise these error for not working properly, and MSQL can also raise these errors when it detects something wrong that is related to driver.
- class MercurySQL.errors.DriverIncompatibleError(driver: str, dv: str, cv: str)
DriverIncompatibleError is raised when the driver version is not supported by MercurySQL.
For details of MercurySQL Versioning System, please see the Drivers.Versioning Chapter.