mirror of https://github.com/zulip/zulip.git
eslint: Fix no-throw-literal.
https://eslint.org/docs/rules/no-throw-literal Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
5c8117a426
commit
043c34d944
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue