Skip to content

Commit

Permalink
lib: do not catch user errors
Browse files Browse the repository at this point in the history
The API caught errors from inside of the users passed through callback.
This never caused any issues, since this API is only used internally.
Otherwise it would have potentially hidden bugs in user code.

Refs: #31133

PR-URL: #31159
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
BridgeAR authored and BethGriggs committed Feb 6, 2020
1 parent fd78d04 commit 7f70c24
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/internal/util/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ function sendInspectorCommand(cb, onError) {
if (!hasInspector) return onError();
const inspector = require('inspector');
if (session === undefined) session = new inspector.Session();
session.connect();
try {
session.connect();
try {
return cb(session);
} finally {
session.disconnect();
}
} catch {
return onError();
return cb(session);
} finally {
session.disconnect();
}
}

Expand Down

0 comments on commit 7f70c24

Please sign in to comment.