Package entropy :: Package db :: Module exceptions

Source Code for Module entropy.db.exceptions

 1  # -*- coding: utf-8 -*- 
 2  """ 
 3   
 4      @author: Fabio Erculiani <[email protected]> 
 5      @contact: [email protected] 
 6      @copyright: Fabio Erculiani 
 7      @license: GPL-2 
 8   
 9      B{Entropy Framework repository exceptions module}. 
10   
11  """ 
12   
13 -class Warning(Exception):
14 """ Exception raised for important warnings like data 15 truncations while inserting, etc. It must be a subclass of 16 the Python StandardError (defined in the module exceptions). """
17
18 -class Error(Exception):
19 """ Exception that is the base class of all other error 20 exceptions. You can use this to catch all errors with one 21 single 'except' statement. Warnings are not considered 22 errors and thus should not use this class as base. It must 23 be a subclass of the Python StandardError (defined in the 24 module exceptions). """
25
26 -class InterfaceError(Error):
27 """ Exception raised for errors that are related to the 28 database interface rather than the database itself. It 29 must be a subclass of Error. """
30
31 -class DatabaseError(Error):
32 """ Exception raised for errors that are related to the 33 database. It must be a subclass of Error. """
34
35 -class DataError(Error):
36 """ Exception raised for errors that are due to problems with 37 the processed data like division by zero, numeric value 38 out of range, etc. It must be a subclass of DatabaseError. """
39
40 -class OperationalError(Error):
41 """ Exception raised for errors that are related to the 42 database's operation and not necessarily under the control 43 of the programmer, e.g. an unexpected disconnect occurs, 44 the data source name is not found, a transaction could not 45 be processed, a memory allocation error occurred during 46 processing, etc. It must be a subclass of DatabaseError. """
47
48 -class IntegrityError(Error):
49 """ Exception raised when the relational integrity of the 50 database is affected, e.g. a foreign key check fails. It 51 must be a subclass of DatabaseError. """
52
53 -class InternalError(Error):
54 """ Exception raised when the database encounters an internal 55 error, e.g. the cursor is not valid anymore, the 56 transaction is out of sync, etc. It must be a subclass of 57 DatabaseError. """
58
59 -class ProgrammingError(Error):
60 """ Exception raised for programming errors, e.g. table not 61 found or already exists, syntax error in the SQL 62 statement, wrong number of parameters specified, etc. It 63 must be a subclass of DatabaseError. """
64
65 -class NotSupportedError(Error):
66 """ Exception raised in case a method or database API was used 67 which is not supported by the database, e.g. requesting a 68 .rollback() on a connection that does not support 69 transaction or has transactions turned off. It must be a 70 subclass of DatabaseError. """
71
72 -class RestartTransaction(Error):
73 """ Exception raised in case the whole transaction has 74 been aborted by the database and caller is kindly 75 required to restart it from the beginning. """
76
77 -class LockAcquireError(Exception):
78 """ Raised when the repository lock, either shared or exclusive, 79 cannot be acquired. """
80