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):
|
def emit(self, record):
|
||||||
# type: (ExceptionReporter) -> None
|
# type: (ExceptionReporter) -> None
|
||||||
try:
|
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:
|
if record.exc_info:
|
||||||
stack_trace = ''.join(traceback.format_exception(*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_full_name = None
|
||||||
user_email = None
|
user_email = None
|
||||||
|
|
||||||
|
data = request.GET if request.method == 'GET' else \
|
||||||
|
exception_filter.get_post_parameters(request)
|
||||||
|
|
||||||
report = dict(
|
report = dict(
|
||||||
node = platform.node(),
|
node = platform.node(),
|
||||||
method = request.method,
|
method = request.method,
|
||||||
path = request.path,
|
path = request.path,
|
||||||
data = request.GET if request.method == 'GET'
|
data = data,
|
||||||
else
|
|
||||||
(filter.get_post_parameters(request)),
|
|
||||||
remote_addr = request.META.get('REMOTE_ADDR', None),
|
remote_addr = request.META.get('REMOTE_ADDR', None),
|
||||||
query_string = request.META.get('QUERY_STRING', None),
|
query_string = request.META.get('QUERY_STRING', None),
|
||||||
server_name = request.META.get('SERVER_NAME', None),
|
server_name = request.META.get('SERVER_NAME', None),
|
||||||
|
@ -61,7 +62,7 @@ class AdminZulipHandler(logging.Handler):
|
||||||
user_full_name = user_full_name,
|
user_full_name = user_full_name,
|
||||||
user_email = user_email,
|
user_email = user_email,
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
report = dict(
|
report = dict(
|
||||||
node = platform.node(),
|
node = platform.node(),
|
||||||
|
@ -79,7 +80,7 @@ class AdminZulipHandler(logging.Handler):
|
||||||
type = "server",
|
type = "server",
|
||||||
report = report,
|
report = report,
|
||||||
), lambda x: None)
|
), lambda x: None)
|
||||||
except:
|
except Exception:
|
||||||
# If this breaks, complain loudly but don't pass the traceback up the stream
|
# 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.
|
# 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)
|
logging.warning("Reporting an exception triggered an exception!", exc_info=True)
|
||||||
|
|
Loading…
Reference in New Issue