import webob.exc
+from cinder import flags
+from cinder.openstack.common import cfg
from cinder.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'),
+]
+
+FLAGS = flags.FLAGS
+FLAGS.register_opts(exc_log_opts)
+
class ConvertedException(webob.exc.WSGIHTTPException):
def __init__(self, code=0, title="", explanation=""):
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 FLAGS.fatal_exception_format_errors:
+ raise e
+ else:
+ # at least get the core message out if something happened
+ message = self.message
super(CinderException, self).__init__(message)