diff options
author | Eugene Nikanorov <enikanorov@mirantis.com> | 2015-01-29 00:32:04 +0300 |
---|---|---|
committer | Eugene Nikanorov <enikanorov@mirantis.com> | 2015-01-30 15:29:27 +0300 |
commit | eeb7ea22bfead713ee54192130796508953b1dec (patch) | |
tree | c2db4adc6b41a33f9c6464b70d9e114da3b1a84f /oslo_db/exception.py | |
parent | 32359046d9d135b95d3fa573f4996e8d65594cb0 (diff) | |
download | oslo-db-eeb7ea22bfead713ee54192130796508953b1dec.tar.gz |
Add retry decorator allowing to retry DB operations on request
Improve retrying decorator such that wrapped code could request
retry attempt in the arbitrary conditions by raising RetryRequest
exception. Wrapped code should provide inner exception that is
raised when amount of retries are exceeded.
Change-Id: I596fea8dc798a11fcdfdd69208af3313f41d755b
Diffstat (limited to 'oslo_db/exception.py')
-rw-r--r-- | oslo_db/exception.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/oslo_db/exception.py b/oslo_db/exception.py index 5de7f1e..f950f6a 100644 --- a/oslo_db/exception.py +++ b/oslo_db/exception.py @@ -171,3 +171,12 @@ class BackendNotAvailable(Exception): within a test suite. """ + + +class RetryRequest(Exception): + """Error raised when DB operation needs to be retried. + + That could be intentionally raised by the code without any real DB errors. + """ + def __init__(self, inner_exc): + self.inner_exc = inner_exc |