diff options
author | Jenkins <jenkins@review.openstack.org> | 2012-12-19 16:21:08 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2012-12-19 16:21:08 +0000 |
commit | 51e34aa44d4c67eb326c0ec57f1cd4d32e46438a (patch) | |
tree | 476739423e8efcbf87cbe0f51227abe3cb118eb7 /nova/exception.py | |
parent | 420e0518c37a4eafb54509e5b4abd692b1caa055 (diff) | |
parent | 2e80b297865e9c7b4251f97a95adaa6f4d0d4643 (diff) | |
download | nova-51e34aa44d4c67eb326c0ec57f1cd4d32e46438a.tar.gz nova-51e34aa44d4c67eb326c0ec57f1cd4d32e46438a.tar.xz nova-51e34aa44d4c67eb326c0ec57f1cd4d32e46438a.zip |
Merge "Add option to make exception format errors fatal."
Diffstat (limited to 'nova/exception.py')
-rw-r--r-- | nova/exception.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/nova/exception.py b/nova/exception.py index fa1a3ac7f..ee0a88a95 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -29,11 +29,21 @@ import itertools import webob.exc +from nova.openstack.common import cfg from nova.openstack.common import excutils from nova.openstack.common import log as logging LOG = logging.getLogger(__name__) +exc_log_opts = [ + cfg.BoolOpt('fatal_exception_format_errors', + default=False, + help='make exception message format errors fatal'), +] + +CONF = cfg.CONF +CONF.register_opts(exc_log_opts) + class ConvertedException(webob.exc.WSGIHTTPException): def __init__(self, code=0, title="", explanation=""): @@ -137,8 +147,12 @@ class NovaException(Exception): LOG.exception(_('Exception in string format operation')) for name, value in kwargs.iteritems(): LOG.error("%s: %s" % (name, value)) - # at least get the core message out if something happened - message = self.message + + if CONF.fatal_exception_format_errors: + raise e + else: + # at least get the core message out if something happened + message = self.message super(NovaException, self).__init__(message) |