diff options
author | Ricardo Carrillo Cruz <emaildericky@gmail.com> | 2011-02-04 11:26:28 +0100 |
---|---|---|
committer | Ricardo Carrillo Cruz <emaildericky@gmail.com> | 2011-02-04 11:26:28 +0100 |
commit | e35ca46173a5f3bf2d1460c19249fd0bf9f5b538 (patch) | |
tree | 39eed216f35ae38d239e68ceec79ac1411110bd3 /nova/exception.py | |
parent | 3ad22216eee67abfabb28efe2561f0fdcf10e6e1 (diff) | |
parent | 5e4259ce6deb227b778acf23770e35f786c9c3d0 (diff) | |
download | nova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.tar.gz nova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.tar.xz nova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.zip |
Fixed PEP8 test problems, complaining about too many blank lines at line 51
Diffstat (limited to 'nova/exception.py')
-rw-r--r-- | nova/exception.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nova/exception.py b/nova/exception.py index 2320e2214..f604fd63a 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -81,6 +81,24 @@ class TimeoutException(Error): pass +class DBError(Error): + """Wraps an implementation specific exception""" + def __init__(self, inner_exception): + self.inner_exception = inner_exception + super(DBError, self).__init__(str(inner_exception)) + + +def wrap_db_error(f): + def _wrap(*args, **kwargs): + try: + return f(*args, **kwargs) + except Exception, e: + LOG.exception(_('DB exception wrapped')) + raise DBError(e) + return _wrap + _wrap.func_name = f.func_name + + def wrap_exception(f): def _wrap(*args, **kw): try: |