diff options
Diffstat (limited to 'oslo_db/exception.py')
-rw-r--r-- | oslo_db/exception.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/oslo_db/exception.py b/oslo_db/exception.py index f950f6a..506006c 100644 --- a/oslo_db/exception.py +++ b/oslo_db/exception.py @@ -87,6 +87,23 @@ class DBDuplicateEntry(DBError): super(DBDuplicateEntry, self).__init__(inner_exception) +class DBConstraintError(DBError): + """Check constraint fails for column error. + + Raised when made an attempt to write to a column a value that does not + satisfy a CHECK constraint. + + :kwarg table: the table name for which the check fails + :type table: str + :kwarg check_name: the table of the check that failed to be satisfied + :type check_name: str + """ + def __init__(self, table, check_name, inner_exception=None): + self.table = table + self.check_name = check_name + super(DBConstraintError, self).__init__(inner_exception) + + class DBReferenceError(DBError): """Foreign key violation error. @@ -155,6 +172,14 @@ class DBConnectionError(DBError): pass +class DBDataError(DBError): + """Raised for errors that are due to problems with the processed data. + + E.g. division by zero, numeric value out of range, incorrect data type, etc + + """ + + class InvalidSortKey(Exception): """A sort key destined for database query usage is invalid.""" |