Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix no-throw-literal.
Anders Kaseorg043c34d944c9
diff --git a/.eslintrc.json b/.eslintrc.jsonindex cc7e6101d39..d0b9e04b876 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -73,6 +73,7 @@"no-script-url": "error","no-self-compare": "error","no-sync": "error",+ "no-throw-literal": "error","no-undef-init": "error","no-unneeded-ternary": ["error", {"defaultAssignment": false}],"no-unused-expressions": "error",diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.jsindex 2c1d5db67b9..b585e79e109 100644--- a/frontend_tests/node_tests/message_fetch.js+++ b/frontend_tests/node_tests/message_fetch.js@@ -91,7 +91,7 @@ function config_fake_channel(conf) {channel.get = function (opts) {if (called && !conf.can_call_again) {- throw "only use this for one call";+ throw new Error("only use this for one call");}if (!conf.can_call_again) {assert(self.success === undefined);diff --git a/frontend_tests/node_tests/transmit.js b/frontend_tests/node_tests/transmit.jsindex 0508e0f3b90..1593fb8a2ef 100644--- a/frontend_tests/node_tests/transmit.js+++ b/frontend_tests/node_tests/transmit.js@@ -56,7 +56,7 @@ run_test("transmit_message_ajax", () => {run_test("transmit_message_ajax_reload_pending", () => {const success = function () {- throw "unexpected success";+ throw new Error("unexpected success");};reload_state.is_pending = function () {diff --git a/frontend_tests/node_tests/util.js b/frontend_tests/node_tests/util.jsindex 89e6a2527d8..f0f57b875c7 100644--- a/frontend_tests/node_tests/util.js+++ b/frontend_tests/node_tests/util.js@@ -107,12 +107,12 @@ run_test("robust_uri_decode", () => {assert.equal(util.robust_uri_decode("xxx%3"), "xxx");set_global("decodeURIComponent", () => {- throw "foo";+ throw new Error("foo");});try {util.robust_uri_decode("%E0%A4%A");} catch (error) {- assert.equal(error, "foo");+ assert.equal(error.message, "foo");}});diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.jsindex 662730b75ae..5d9f4c4d2a5 100644--- a/frontend_tests/zjsunit/index.js+++ b/frontend_tests/zjsunit/index.js@@ -35,7 +35,7 @@ function immediate(f) {// Find the files we need to run.const files = process.argv.slice(2);if (files.length === 0) {- throw "No tests found";+ throw new Error("No tests found");}// Set up our namespace helpers.