Skip to content

Commit

Permalink
Annotate when exceptions are caught but ignored; closes #3354 (#3356)
Browse files Browse the repository at this point in the history
* style(*various*): Annotate when exceptions are caught but ignored

There's an existing convertion to name intentionally ignored errors in catch block as `ignore`.
Modified codebase to follow it.

Fixes #3354

* style(bin/options.js): Turn off prettier for single line

Prettier reformatting is just wrong here. fs.readFileSync() should **not** be split across multiple
lines.

* Revert "style(bin/options.js): Turn off prettier for single line"

This reverts commit eb034dd.

* style(bin/options.js): Revert un-Prettier comment per Boneskull's request
  • Loading branch information
plroebuck authored and boneskull committed May 1, 2018
1 parent 1606f35 commit 8368722
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bin/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ function getOptions() {
process.argv = process.argv
.slice(0, 2)
.concat(opts.concat(process.argv.slice(2)));
} catch (err) {
// ignore
} catch (ignore) {
// NOTE: should console.error() and throw the error
}

process.env.LOADED_MOCHA_OPTS = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/browser/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Progress.prototype.draw = function(ctx) {
var w = ctx.measureText(text).width;

ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
} catch (err) {
} catch (ignore) {
// don't fail if we can't render progress
}
return this;
Expand Down
2 changes: 1 addition & 1 deletion lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Runner.prototype.fail = function(test, err) {
try {
err.stack =
this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
} catch (ignored) {
} catch (ignore) {
// some environments do not take kindly to monkeying with the stack
}

Expand Down

0 comments on commit 8368722

Please sign in to comment.