mirror of https://github.com/zulip/zulip.git
AdminZulipHandler: Don't print extra traceback for logged-out users.
This is not an interesting condition worth highlighting for sysadmins. Fixes #3963.
This commit is contained in:
parent
b1e7ecdad2
commit
6e442902e1
|
@ -38,12 +38,17 @@ class AdminZulipHandler(logging.Handler):
|
||||||
stack_trace = None
|
stack_trace = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from django.contrib.auth.models import AnonymousUser
|
||||||
user_profile = request.user
|
user_profile = request.user
|
||||||
user_full_name = user_profile.full_name
|
if isinstance(user_profile, AnonymousUser):
|
||||||
user_email = user_profile.email
|
user_full_name = None
|
||||||
|
user_email = None
|
||||||
|
else:
|
||||||
|
user_full_name = user_profile.full_name
|
||||||
|
user_email = user_profile.email
|
||||||
except Exception:
|
except Exception:
|
||||||
|
# Unexpected exceptions here should be handled gracefully
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
# Error was triggered by an anonymous user.
|
|
||||||
user_full_name = None
|
user_full_name = None
|
||||||
user_email = None
|
user_email = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue