mirror of https://github.com/zulip/zulip.git
zerver: Fix bare except clause.
This commit is contained in:
parent
3823376b3f
commit
89a126b93f
|
@ -27,9 +27,9 @@ class AdminZulipHandler(logging.Handler):
|
|||
def emit(self, record):
|
||||
# type: (ExceptionReporter) -> None
|
||||
try:
|
||||
request = record.request # type: HttpRequest
|
||||
request = record.request # type: HttpRequest
|
||||
|
||||
filter = get_exception_reporter_filter(request)
|
||||
exception_filter = get_exception_reporter_filter(request)
|
||||
|
||||
if record.exc_info:
|
||||
stack_trace = ''.join(traceback.format_exception(*record.exc_info))
|
||||
|
@ -46,13 +46,14 @@ class AdminZulipHandler(logging.Handler):
|
|||
user_full_name = None
|
||||
user_email = None
|
||||
|
||||
data = request.GET if request.method == 'GET' else \
|
||||
exception_filter.get_post_parameters(request)
|
||||
|
||||
report = dict(
|
||||
node = platform.node(),
|
||||
method = request.method,
|
||||
path = request.path,
|
||||
data = request.GET if request.method == 'GET'
|
||||
else
|
||||
(filter.get_post_parameters(request)),
|
||||
data = data,
|
||||
remote_addr = request.META.get('REMOTE_ADDR', None),
|
||||
query_string = request.META.get('QUERY_STRING', None),
|
||||
server_name = request.META.get('SERVER_NAME', None),
|
||||
|
@ -61,7 +62,7 @@ class AdminZulipHandler(logging.Handler):
|
|||
user_full_name = user_full_name,
|
||||
user_email = user_email,
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
report = dict(
|
||||
node = platform.node(),
|
||||
|
@ -79,7 +80,7 @@ class AdminZulipHandler(logging.Handler):
|
|||
type = "server",
|
||||
report = report,
|
||||
), lambda x: None)
|
||||
except:
|
||||
except Exception:
|
||||
# If this breaks, complain loudly but don't pass the traceback up the stream
|
||||
# However, we *don't* want to use logging.exception since that could trigger a loop.
|
||||
logging.warning("Reporting an exception triggered an exception!", exc_info=True)
|
||||
|
|
Loading…
Reference in New Issue