summaryrefslogtreecommitdiff
path: root/horizon/exceptions.py
diff options
context:
space:
mode:
authorSam Betts <sam@code-smash.net>2015-09-07 14:32:02 +0100
committerSam Betts <sam@code-smash.net>2015-09-07 14:32:02 +0100
commit5ca1a5230025a6b66bd90467692e9541c9fff52d (patch)
tree32556bff464b6c263d68bd1d658c8a69f48d951c /horizon/exceptions.py
parent299b28ea66a7d9b7420af400787eb77dc7159dab (diff)
downloadhorizon-5ca1a5230025a6b66bd90467692e9541c9fff52d.tar.gz
Ensure exc message is included in user_message
In exception.handle the user_message was being overridden so failed to include the exception message even if %(exc)s was in the message. This patch ensures the correct user_message is produced by exception.handle() Change-Id: I2bcc041a2f8a3b929c1acbbf3d3ff1e76b5646e9 Closes-Bug: #1493025
Diffstat (limited to 'horizon/exceptions.py')
-rw-r--r--horizon/exceptions.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/horizon/exceptions.py b/horizon/exceptions.py
index 539a4f76a..b09a2a6d2 100644
--- a/horizon/exceptions.py
+++ b/horizon/exceptions.py
@@ -334,14 +334,14 @@ def handle(request, message=None, redirect=None, ignore=False,
log_entry = encoding.force_text(exc_value)
- # We trust messages from our own exceptions
user_message = ""
+ # We trust messages from our own exceptions
if issubclass(exc_type, HorizonException):
- user_message = exc_value
+ user_message = log_entry
# If the message has a placeholder for the exception, fill it in
elif message and "%(exc)s" in message:
user_message = encoding.force_text(message) % {"exc": log_entry}
- if message:
+ elif message:
user_message = encoding.force_text(message)
for exc_handler in HANDLE_EXC_METHODS:
@@ -349,7 +349,7 @@ def handle(request, message=None, redirect=None, ignore=False,
if exc_handler['set_wrap']:
wrap = True
handler = exc_handler['handler']
- ret = handler(request, message, redirect, ignore,
+ ret = handler(request, user_message, redirect, ignore,
exc_handler.get('escalate', escalate),
handled, force_silence, force_log,
log_method, log_entry, log_level)