mirror of https://github.com/zulip/zulip.git
bugdown: Include message id in exceptions.
This commit is contained in:
parent
643d4cacd3
commit
c2fcfc087a
|
@ -2139,6 +2139,11 @@ def do_convert(content: str,
|
||||||
else:
|
else:
|
||||||
realm_filters_key = message_realm.id
|
realm_filters_key = message_realm.id
|
||||||
|
|
||||||
|
if message and hasattr(message, 'id') and message.id:
|
||||||
|
logging_message_id = 'id# ' + str(message.id)
|
||||||
|
else:
|
||||||
|
logging_message_id = 'unknown'
|
||||||
|
|
||||||
if message is not None and message_realm is not None:
|
if message is not None and message_realm is not None:
|
||||||
if message_realm.is_zephyr_mirror_realm:
|
if message_realm.is_zephyr_mirror_realm:
|
||||||
if message.sending_client.name == "zephyr_mirror":
|
if message.sending_client.name == "zephyr_mirror":
|
||||||
|
@ -2213,16 +2218,16 @@ def do_convert(content: str,
|
||||||
# rest of the codebase from any bugs where we end up rendering
|
# rest of the codebase from any bugs where we end up rendering
|
||||||
# something huge.
|
# something huge.
|
||||||
if len(rendered_content) > MAX_MESSAGE_LENGTH * 10:
|
if len(rendered_content) > MAX_MESSAGE_LENGTH * 10:
|
||||||
raise BugdownRenderingException('Rendered content exceeds %s characters' %
|
raise BugdownRenderingException('Rendered content exceeds %s characters (message %s)' %
|
||||||
(MAX_MESSAGE_LENGTH * 10,))
|
(MAX_MESSAGE_LENGTH * 10, logging_message_id))
|
||||||
return rendered_content
|
return rendered_content
|
||||||
except Exception:
|
except Exception:
|
||||||
cleaned = privacy_clean_markdown(content)
|
cleaned = privacy_clean_markdown(content)
|
||||||
# NOTE: Don't change this message without also changing the
|
# NOTE: Don't change this message without also changing the
|
||||||
# logic in logging_handlers.py or we can create recursive
|
# logic in logging_handlers.py or we can create recursive
|
||||||
# exceptions.
|
# exceptions.
|
||||||
exception_message = ('Exception in Markdown parser: %sInput (sanitized) was: %s'
|
exception_message = ('Exception in Markdown parser: %sInput (sanitized) was: %s\n (message %s)'
|
||||||
% (traceback.format_exc(), cleaned))
|
% (traceback.format_exc(), cleaned, logging_message_id))
|
||||||
bugdown_logger.exception(exception_message)
|
bugdown_logger.exception(exception_message)
|
||||||
|
|
||||||
raise BugdownRenderingException()
|
raise BugdownRenderingException()
|
||||||
|
|
Loading…
Reference in New Issue