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-optional-catch-binding.

Anders Kaseorgd65499216479
diff --git a/static/js/hash_util.js b/static/js/hash_util.js
index fddeff23e44..ed84eac58c6 100644
--- a/static/js/hash_util.js
+++ b/static/js/hash_util.js
@@ -66,7 +66,7 @@ exports.decodeHashComponent = function (str) {
// that the url is invalid.
// TODO: Show possible valid urls to the user.
return decodeURIComponent(str.replace(/\./g, "%"));
- } catch (e) {
+ } catch {
ui_report.error(i18n.t("Invalid URL"), undefined, $("#home-error"), 2000);
return "";
}
diff --git a/static/js/localstorage.js b/static/js/localstorage.js
index 48f4617486e..dd09ff76029 100644
--- a/static/js/localstorage.js
+++ b/static/js/localstorage.js
@@ -5,7 +5,7 @@ const ls = {
parseJSON(str) {
try {
return JSON.parse(str);
- } catch (err) {
+ } catch {
return undefined;
}
},
@@ -169,7 +169,7 @@ let warned_of_localstorage = false;
localstorage.supported = function supports_localstorage() {
try {
return window.localStorage !== undefined && window.localStorage !== null;
- } catch (e) {
+ } catch {
if (!warned_of_localstorage) {
blueslip.error(
"Client browser does not support local storage, will lose socket message on reload",
diff --git a/static/js/portico/integrations_dev_panel.js b/static/js/portico/integrations_dev_panel.js
index 0d24e7079ce..87a0e4cab6c 100644
--- a/static/js/portico/integrations_dev_panel.js
+++ b/static/js/portico/integrations_dev_panel.js
@@ -84,7 +84,7 @@ function get_custom_http_headers() {
try {
// Let JavaScript validate the JSON for us.
custom_headers = JSON.stringify(JSON.parse(custom_headers));
- } catch (err) {
+ } catch {
set_results_notice("Custom HTTP headers are not in a valid JSON format.", "warning");
return undefined;
}
@@ -189,7 +189,7 @@ function handle_unsuccessful_response(response) {
const status_code = response.statusCode().status;
response = JSON.parse(response.responseText);
set_results_notice("Result: " + "(" + status_code + ") " + response.msg, "warning");
- } catch (err) {
+ } catch {
// If the response is not a JSON response, then it is probably
// Django returning an HTML response containing a stack trace
// with useful debugging information regarding the backend
@@ -262,7 +262,7 @@ function send_webhook_fixture_message() {
// Let JavaScript validate the JSON for us.
body = JSON.stringify(JSON.parse(body));
is_json = true;
- } catch (err) {
+ } catch {
set_results_notice("Invalid JSON in fixture body.", "warning");
return;
}
diff --git a/static/js/submessage.js b/static/js/submessage.js
index cd7ebac2260..9a40832435d 100644
--- a/static/js/submessage.js
+++ b/static/js/submessage.js
@@ -119,7 +119,7 @@ exports.handle_event = function (submsg) {
try {
data = JSON.parse(submsg.content);
- } catch (err) {
+ } catch {
blueslip.error("server sent us invalid json in handle_event: " + submsg.content);
return;
}
diff --git a/static/js/upload.js b/static/js/upload.js
index 74cb40742bd..ea381031520 100644
--- a/static/js/upload.js
+++ b/static/js/upload.js
@@ -164,7 +164,7 @@ exports.upload_files = function (uppy, config, files) {
type: file.type,
data: file,
});
- } catch (error) {
+ } catch {
// Errors are handled by info-visible and upload-error event callbacks.
break;
}
diff --git a/static/js/util.js b/static/js/util.js
index 6ed237d9720..ec4ceb9171b 100644
--- a/static/js/util.js
+++ b/static/js/util.js
@@ -143,7 +143,7 @@ exports.make_strcmp = function () {
try {
const collator = new Intl.Collator();
return collator.compare;
- } catch (e) {
+ } catch {
// continue regardless of error
}
diff --git a/static/shared/js/fenced_code.js b/static/shared/js/fenced_code.js
index cd53cfa5676..48bbd336485 100644
--- a/static/shared/js/fenced_code.js
+++ b/static/shared/js/fenced_code.js
@@ -78,7 +78,7 @@ function wrap_tex(tex) {
return katex.renderToString(tex, {
displayMode: true,
});
- } catch (ex) {
+ } catch {
return '<span class="tex-error">' + _.escape(tex) + "</span>";
}
}