]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Log exception.msg before exception.message
authorKevin Benton <blak111@gmail.com>
Tue, 15 Sep 2015 17:22:35 +0000 (10:22 -0700)
committerKevin Benton <blak111@gmail.com>
Tue, 15 Sep 2015 18:58:21 +0000 (11:58 -0700)
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

index bf39cd8b685bae859b281ddc274cc7a0c064a5be..78b2cba54ccdfab34b2bf69de538f64bc88df3ad 100644 (file)
@@ -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)