Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
refactor: Change BugdownRenderingException to MarkdownRenderingException.
Mohit Gupta05cce86670e6
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 5da6079fe3d..5c6c0203a89 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -86,9 +86,9 @@ from zerver.lib.email_validation import ()from zerver.lib.emoji import emoji_name_to_emoji_code, get_emoji_file_namefrom zerver.lib.exceptions import (- BugdownRenderingException,ErrorCode,JsonableError,+ MarkdownRenderingException,StreamDoesNotExistError,StreamWithIDDoesNotExistError,)@@ -1055,7 +1055,7 @@ def render_incoming_message(message: Message,mention_data=mention_data,email_gateway=email_gateway,)- except BugdownRenderingException:+ except MarkdownRenderingException:raise JsonableError(_('Unable to render message'))return rendered_contentdiff --git a/zerver/lib/exceptions.py b/zerver/lib/exceptions.pyindex 57db95d943a..e488bb4a875 100644--- a/zerver/lib/exceptions.py+++ b/zerver/lib/exceptions.py@@ -212,7 +212,7 @@ class OrganizationOwnerRequired(JsonableError):def msg_format() -> str:return OrganizationOwnerRequired.OWNER_REQUIRED_MESSAGE-class BugdownRenderingException(Exception):+class MarkdownRenderingException(Exception):passclass InvalidAPIKeyError(JsonableError):diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.pyindex 1a4ade5779b..8951e759c90 100644--- a/zerver/lib/markdown/__init__.py+++ b/zerver/lib/markdown/__init__.py@@ -49,7 +49,7 @@ from zerver.lib.emoji import (name_to_codepoint,translate_emoticons,)-from zerver.lib.exceptions import BugdownRenderingException+from zerver.lib.exceptions import MarkdownRenderingExceptionfrom zerver.lib.markdown import fenced_codefrom zerver.lib.markdown.fenced_code import FENCE_REfrom zerver.lib.mention import extract_user_group, possible_mentions, possible_user_group_mentions@@ -2362,7 +2362,7 @@ def do_convert(content: str,# rest of the codebase from any bugs where we end up rendering# something huge.if len(rendered_content) > MAX_MESSAGE_LENGTH * 10:- raise BugdownRenderingException(+ raise MarkdownRenderingException(f'Rendered content exceeds {MAX_MESSAGE_LENGTH * 10} characters (message {logging_message_id})')return rendered_content@@ -2377,7 +2377,7 @@ def do_convert(content: str,logging_message_id,)- raise BugdownRenderingException()+ raise MarkdownRenderingException()finally:# These next three lines are slightly paranoid, since# we always set these right before actually using thediff --git a/zerver/lib/markdown/fenced_code.py b/zerver/lib/markdown/fenced_code.pyindex 3a800826033..f94596733a2 100644--- a/zerver/lib/markdown/fenced_code.py+++ b/zerver/lib/markdown/fenced_code.py@@ -82,7 +82,7 @@ import markdownfrom django.utils.html import escapefrom markdown.extensions.codehilite import CodeHilite, CodeHiliteExtension-from zerver.lib.exceptions import BugdownRenderingException+from zerver.lib.exceptions import MarkdownRenderingExceptionfrom zerver.lib.tex import render_tex# Global vars@@ -127,7 +127,7 @@ Missing required -X argument in curl command:regex = r'curl [-](sS)?X "?(GET|DELETE|PATCH|POST)"?'if line.startswith('curl'):if re.search(regex, line) is None:- raise BugdownRenderingException(error_msg.format(command=line.strip()))+ raise MarkdownRenderingException(error_msg.format(command=line.strip()))CODE_VALIDATORS = {diff --git a/zerver/tests/test_bugdown.py b/zerver/tests/test_bugdown.pyindex 7a7dfb24528..db88aaefe15 100644--- a/zerver/tests/test_bugdown.py+++ b/zerver/tests/test_bugdown.py@@ -20,7 +20,7 @@ from zerver.lib.actions import (from zerver.lib.alert_words import get_alert_word_automatonfrom zerver.lib.create_user import create_userfrom zerver.lib.emoji import get_emoji_url-from zerver.lib.exceptions import BugdownRenderingException+from zerver.lib.exceptions import MarkdownRenderingExceptionfrom zerver.lib.mention import possible_mentions, possible_user_group_mentionsfrom zerver.lib.message import render_markdownfrom zerver.lib.request import JsonableError@@ -2090,7 +2090,7 @@ class BugdownApiTests(ZulipTestCase):class BugdownErrorTests(ZulipTestCase):def test_bugdown_error_handling(self) -> None:with self.simulated_markdown_failure():- with self.assertRaises(BugdownRenderingException):+ with self.assertRaises(MarkdownRenderingException):bugdown_convert('')def test_send_message_errors(self) -> None:@@ -2109,7 +2109,7 @@ class BugdownErrorTests(ZulipTestCase):with mock.patch('zerver.lib.markdown.timeout', return_value=msg), \mock.patch('zerver.lib.markdown.bugdown_logger'):- with self.assertRaises(BugdownRenderingException):+ with self.assertRaises(MarkdownRenderingException):bugdown_convert(msg)def test_curl_code_block_validation(self) -> None:@@ -2128,7 +2128,7 @@ class BugdownErrorTests(ZulipTestCase):'```',]- with self.assertRaises(BugdownRenderingException):+ with self.assertRaises(MarkdownRenderingException):processor.run(markdown)def test_curl_code_block_without_validation(self) -> None: