Properly re-raise exceptions in proxy_logging

Previously, this could encounter TypeErrors, presumably because
sys.exc_clear() was called somewhere in the block of code between
catching the exception and re-raising.

Related-Bug: 1181146
Change-Id: Iadeea3f61e70bf83dc0eb063fdb27edd16f3ca32
This commit is contained in:
Tim Burke 2015-05-08 11:45:12 -07:00
parent 664a632c01
commit 90b84d3a69
1 changed files with 3 additions and 1 deletions

View File

@ -71,6 +71,7 @@ if this is a middleware subrequest or not. A log processor calculating
bandwidth usage will want to only sum up logs with no swift.source.
"""
import sys
import time
from urllib import quote, unquote
@ -296,12 +297,13 @@ class ProxyLoggingMiddleware(object):
try:
iterable = self.app(env, my_start_response)
except Exception:
exc_type, exc_value, exc_traceback = sys.exc_info()
req = Request(env)
status_int = status_int_for_logging(start_status=500)
self.log_request(
req, status_int, input_proxy.bytes_received, 0, start_time,
time.time())
raise
raise exc_type, exc_value, exc_traceback
else:
return iter_response(iterable)