Closed Bug 1544284 Opened 9 months ago Closed 9 months ago

Enable ESLint rule no-throw-literal in toolkit/

Categories

(Toolkit :: General, enhancement, P3, minor)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: Kwan, Assigned: Kwan)

References

Details

Attachments

(2 files)

no-throw-literal helps ensure that when we do throw errors, they come with stack traces that help track down the source of the error.

Result of running:
$ mach eslint -funix toolkit/ | sed -Ee 's/:.+//' - | xargs sed -E
-e 's/throw ((["])[^"]+\2);/throw new Error(\1);/g' \ -e 's/throw ((["])[^"]+\2 + [^ ";]+);/throw new Error(\1);/g'
-e 's/throw (/throw new Error(/g' -i

...and then reverting a couple of places where comments were touched,
as well as changes to toolkit/components/ctypes/tests/unit/test_jsctypes.js
that required expectation changes to
toolkit/components/ctypes/tests/chrome/test_ctypes.xul

Includes an otherwise-automated change to test_jsctypes.js that required an
expectation change in test_ctypes.xul.

Pushed by aiakab@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5e262e96eac7
toolkit/ automated ESLint no-throw-literal fixes. r=Standard8
https://hg.mozilla.org/integration/autoland/rev/64a7117d2260
toolkit/ manual ESLint no-throw-literal fixes. r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.