From: Kevin Benton Date: Tue, 15 Sep 2015 17:22:35 +0000 (-0700) Subject: Log exception.msg before exception.message X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=3cf7838344fa009060253bf8ead3c28278f8f54a;p=openstack-build%2Fneutron-build.git Log exception.msg before exception.message The exception translation hook was logging the exception messages before variables were interpolated, making it really unhelpful. This patch corrects that and falls back to e.message if e.msg isn't available. Change-Id: I331444d577b03257db2fcc96324d020eff9bef08 --- diff --git a/neutron/pecan_wsgi/hooks/translation.py b/neutron/pecan_wsgi/hooks/translation.py index bf39cd8b6..78b2cba54 100644 --- a/neutron/pecan_wsgi/hooks/translation.py +++ b/neutron/pecan_wsgi/hooks/translation.py @@ -30,7 +30,7 @@ class ExceptionTranslationHook(hooks.PecanHook): return for exc_class, to_class in v2base.FAULT_MAP.items(): if isinstance(e, exc_class): - raise to_class(e.message) + raise to_class(getattr(e, 'msg', e.message)) # leaked unexpected exception, convert to boring old 500 error and # hide message from user in case it contained sensitive details LOG.exception(_("An unexpected exception was caught: %s") % e)