Closed
Bug 1294619
Opened 9 years ago
Closed 9 years ago
Enable the no-ex-assign rule for eslint
Categories
(Toolkit :: General, defect)
Toolkit
General
Tracking
()
RESOLVED
FIXED
mozilla51
| Tracking | Status | |
|---|---|---|
| firefox51 | --- | fixed |
People
(Reporter: jaws, Assigned: jaws)
Details
Attachments
(1 file)
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?
Flags: needinfo?(paolo.mozmail)
Comment 1•9 years ago
|
||
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.
Flags: needinfo?(paolo.mozmail)
| Comment hidden (mozreview-request) |
| Assignee | ||
Comment 3•9 years ago
|
||
| mozreview-review | ||
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+
| Assignee | ||
Comment 4•9 years ago
|
||
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
Comment 5•9 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in
before you can comment on or make changes to this bug.
Description
•