diff options
| author | Ken Pepple <ken.pepple@gmail.com> | 2011-04-21 10:29:11 -0700 |
|---|---|---|
| committer | Ken Pepple <ken.pepple@gmail.com> | 2011-04-21 10:29:11 -0700 |
| commit | f205dcf659697adaae0d85a042ea2ea7ffe5c1c7 (patch) | |
| tree | b2da90f0cb240450bc30b9d6ebc3c703145b9bb6 /nova/exception.py | |
| parent | dfcdafde2dc202aa3325cd1cea8d809f56fdde57 (diff) | |
| parent | c796920198305e101c75bcbf4e027ba9e81975d7 (diff) | |
| download | nova-f205dcf659697adaae0d85a042ea2ea7ffe5c1c7.tar.gz nova-f205dcf659697adaae0d85a042ea2ea7ffe5c1c7.tar.xz nova-f205dcf659697adaae0d85a042ea2ea7ffe5c1c7.zip | |
rebase trunk
Diffstat (limited to 'nova/exception.py')
| -rw-r--r-- | nova/exception.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/nova/exception.py b/nova/exception.py index 4e2bbdbaf..3123b2f1f 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -16,31 +16,34 @@ # License for the specific language governing permissions and limitations # under the License. -""" -Nova base exception handling, including decorator for re-raising -Nova-type exceptions. SHOULD include dedicated exception logging. +"""Nova base exception handling. + +Includes decorator for re-raising Nova-type exceptions. + +SHOULD include dedicated exception logging. + """ from nova import log as logging + + LOG = logging.getLogger('nova.exception') class ProcessExecutionError(IOError): - def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None, description=None): if description is None: - description = _("Unexpected error while running command.") + description = _('Unexpected error while running command.') if exit_code is None: exit_code = '-' - message = _("%(description)s\nCommand: %(cmd)s\n" - "Exit code: %(exit_code)s\nStdout: %(stdout)r\n" - "Stderr: %(stderr)r") % locals() + message = _('%(description)s\nCommand: %(cmd)s\n' + 'Exit code: %(exit_code)s\nStdout: %(stdout)r\n' + 'Stderr: %(stderr)r') % locals() IOError.__init__(self, message) class Error(Exception): - def __init__(self, message=None): super(Error, self).__init__(message) @@ -97,7 +100,7 @@ class TimeoutException(Error): class DBError(Error): - """Wraps an implementation specific exception""" + """Wraps an implementation specific exception.""" def __init__(self, inner_exception): self.inner_exception = inner_exception super(DBError, self).__init__(str(inner_exception)) @@ -108,7 +111,7 @@ def wrap_db_error(f): try: return f(*args, **kwargs) except Exception, e: - LOG.exception(_('DB exception wrapped')) + LOG.exception(_('DB exception wrapped.')) raise DBError(e) return _wrap _wrap.func_name = f.func_name |
