Closed Bug 1294619 Opened 3 years ago Closed 3 years ago
Enable the no-ex-assign rule for eslint
58 bytes, text/x-review-board-request
no-ex-assign: disallow reassigning exceptions in catch clauses If a catch clause in a try statement accidentally (or purposely) assigns another value to the exception parameter, it impossible to refer to the error from that point on. Since there is no arguments object to offer alternative access to this data, assignment of the parameter is absolutely destructive. Paolo, I would like to enable this rule but it is currently failing due to two lines in DownloadCore.jsm: https://hg.mozilla.org/mozilla-central/file/ab1d29e62ee4/toolkit/components/jsdownloads/src/DownloadCore.jsm#l526 and https://hg.mozilla.org/mozilla-central/file/ab1d29e62ee4/toolkit/components/jsdownloads/src/DownloadCore.jsm#l539 Can you give some advice on how you would like this code refactored?
The simple approach will work for now. In the future, the refactoring in bug 1265329 might result in us doing less work in the catch block.
Comment on attachment 8780461 [details] Bug 1294619 - Update jsdownloads code to enable the no-ex-assign rule for ESLint. https://reviewboard.mozilla.org/r/71168/#review68748 Thanks! I'll land this.
Attachment #8780461 - Flags: review?(jaws) → review+
https://hg.mozilla.org/integration/fx-team/rev/8725f14625e0c87776f9acf66e6712ceca301000 Bug 1294619 - Update jsdownloads code to enable the no-ex-assign rule for ESLint. r=jaws
You need to log in before you can comment on or make changes to this bug.