From 3cf7838344fa009060253bf8ead3c28278f8f54a Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Tue, 15 Sep 2015 10:22:35 -0700 Subject: [PATCH] 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 --- neutron/pecan_wsgi/hooks/translation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.45.2