diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-06-13 18:56:17 -0400 |
---|---|---|
committer | Roman Podoliaka <rpodolyaka@mirantis.com> | 2016-07-27 08:39:20 +0000 |
commit | 60b5b14988b2986c161e6a25dc5030a31d41728b (patch) | |
tree | 7b6bca40fb84d44ab757cd0d51326c386382bf08 /oslo_db/exception.py | |
parent | a79479088029e4fa51def91cb36bc652356462b6 (diff) | |
download | oslo-db-60b5b14988b2986c161e6a25dc5030a31d41728b.tar.gz |
Memoize sys.exc_info() before attempting a savepoint rollback
This presents a system of reporting the ultimate "cause" in the
case that a MySQL failed SAVEPOINT rollback occurs.
Change-Id: Iea834429a0b8398f076b10426525a5c17dbf3c85
Diffstat (limited to 'oslo_db/exception.py')
-rw-r--r-- | oslo_db/exception.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/oslo_db/exception.py b/oslo_db/exception.py index 16dec7f..2d118cd 100644 --- a/oslo_db/exception.py +++ b/oslo_db/exception.py @@ -47,9 +47,10 @@ import debtcollector.removals import six from oslo_db._i18n import _ +from oslo_utils.excutils import CausedByException -class DBError(Exception): +class DBError(CausedByException): """Base exception for all custom database exceptions. @@ -57,9 +58,9 @@ class DBError(Exception): DBError or its subclasses. """ - def __init__(self, inner_exception=None): + def __init__(self, inner_exception=None, cause=None): self.inner_exception = inner_exception - super(DBError, self).__init__(six.text_type(inner_exception)) + super(DBError, self).__init__(six.text_type(inner_exception), cause) class DBDuplicateEntry(DBError): |