Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

markdown: Avoid blueslip dependency.

Steve Howellc7ed21f89177
diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js
index 125eecc86bc..a914659b599 100644
--- a/frontend_tests/node_tests/markdown.js
+++ b/frontend_tests/node_tests/markdown.js
@@ -6,7 +6,6 @@ const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_c
const markdown_assert = require("../zjsunit/markdown_assert");
const {set_global, with_field_rewire, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
-const blueslip = require("../zjsunit/zblueslip");
const {page_params, user_settings} = require("../zjsunit/zpage_params");
const example_realm_linkifiers = [
@@ -850,7 +849,6 @@ test("missing unicode emojis", ({override_rewire}) => {
});
test("katex_throws_unexpected_exceptions", () => {
- blueslip.expect("error", "Error: some-exception");
const message = {raw_content: "$$a$$"};
with_field_rewire(
markdown,
@@ -861,7 +859,10 @@ test("katex_throws_unexpected_exceptions", () => {
},
},
() => {
- markdown.apply_markdown(message);
+ assert.throws(() => markdown.apply_markdown(message), {
+ name: "Error",
+ message: "some-exception\nPlease report this to https://github.com/chjj/marked.",
+ });
},
);
});
diff --git a/static/js/markdown.js b/static/js/markdown.js
index a34404b90d9..360822379a1 100644
--- a/static/js/markdown.js
+++ b/static/js/markdown.js
@@ -5,8 +5,6 @@ import _ from "lodash";
import * as fenced_code from "../shared/js/fenced_code";
import marked from "../third/marked/lib/marked";
-import * as blueslip from "./blueslip";
-
// This contains zulip's frontend Markdown implementation; see
// docs/subsystems/markdown.md for docs on our Markdown syntax. The other
// main piece in rendering Markdown client-side is
@@ -439,8 +437,7 @@ function handleTex(tex, fullmatch) {
// TeX syntax error
return `<span class="tex-error">${_.escape(fullmatch)}</span>`;
}
- blueslip.error(error);
- return undefined;
+ throw new Error(error.message);
}
}