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.

eslint: Fix unicorn/prefer-type-error.

Anders Kaseorg0d4af4f8e727
diff --git a/frontend_tests/zjsunit/namespace.js b/frontend_tests/zjsunit/namespace.js
index a113f18087e..2eb8f010eb3 100644
--- a/frontend_tests/zjsunit/namespace.js
+++ b/frontend_tests/zjsunit/namespace.js
@@ -99,7 +99,7 @@ exports.with_overrides = function (test_function) {
const override = function (name, f) {
if (typeof f !== "function") {
- throw new Error("You can only override with a function.");
+ throw new TypeError("You can only override with a function.");
}
unused_funcs.set(name, true);
diff --git a/static/js/message_list.js b/static/js/message_list.js
index 8dee053a9e5..a7a731161b3 100644
--- a/static/js/message_list.js
+++ b/static/js/message_list.js
@@ -152,7 +152,7 @@ class MessageList {
const convert_id = (str_id) => {
const id = Number.parseFloat(str_id);
if (Number.isNaN(id)) {
- throw new Error("Bad message id " + str_id);
+ throw new TypeError("Bad message id " + str_id);
}
return id;
};
diff --git a/static/js/message_list_data.js b/static/js/message_list_data.js
index 410be073953..78ed2896e1a 100644
--- a/static/js/message_list_data.js
+++ b/static/js/message_list_data.js
@@ -442,7 +442,7 @@ class MessageListData {
messages.forEach((elem) => {
const id = Number.parseFloat(elem.id);
if (Number.isNaN(id)) {
- throw new Error("Bad message id");
+ throw new TypeError("Bad message id");
}
if (this._is_localonly_id(id)) {
this._local_only.add(id);