python database error handling

API defines a number of errors and abnormal operation of the database DB, the following table lists the errors and exceptions:

abnormal description
Warning When there is a serious warning triggers, such as inserting data is truncated, and so on. It must be a subclass of StandardError.
Error All other error classes other than warnings. It must be a subclass of StandardError.
InterfaceError Fires when the database interface module has its own error (instead of an error database) occur. It must be a subclass of Error.
DatabaseError When triggered, and database-related errors. It must be a subclass of Error.
DataError When there is a data processing error triggered, for example: divide by zero error, the data of range and so on. It must be a subclass of DatabaseError.
OperationalError It refers to a non-user-controlled, but the operation error occurs when the database. For example: accidentally disconnected, the database name is not found, the transaction fails, memory allocation errors, and so is the operational database error occurred. It must be a subclass of DatabaseError.
IntegrityError Integrity related errors, such as foreign keys and the like check failed. DatabaseError must be a subclass.
InternalError Internal error database, such as cursor (cursor) fails, the transaction synchronization failed, and so on. DatabaseError must be a subclass.
ProgrammingError Procedural errors, such as data table (table) not found or already exists, SQL statement syntax error, the error number of parameters, and so on. It must be a subclass of DatabaseError.
NotSupportedError Not supported error, refers to the use of the database does not support other functions or API. For example, on a connection object .rollback () function, however, it does not support a transaction or a database transaction has closed. It must be a subclass of DatabaseError.

 

Marble platform knowledge

Guess you like

Origin www.cnblogs.com/furuihua/p/11289934.html