diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-04-21 22:15:16 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-04-21 22:15:16 -0400 |
| commit | aa0de1bba066682a1892ae2dcd1f92ebdd231f7c (patch) | |
| tree | 0e17219355390996a9eaff6835eae38747115b91 /nova/exception.py | |
| parent | f5ef0e4bf39e01b46db241f5766db60059d52df3 (diff) | |
| parent | 659ae2ce4685034f9979702ca92a361acc23b1b6 (diff) | |
| download | nova-aa0de1bba066682a1892ae2dcd1f92ebdd231f7c.tar.gz nova-aa0de1bba066682a1892ae2dcd1f92ebdd231f7c.tar.xz nova-aa0de1bba066682a1892ae2dcd1f92ebdd231f7c.zip | |
merging 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 6948a93c1..01a9d183a 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) @@ -93,7 +96,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)) @@ -104,7 +107,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 |
