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: nodejs#31133

PR-URL: nodejs#31159
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
BridgeAR authored and Trott committed Jan 4, 2020
1 parent 36c212e commit 904a81d
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 904a81d

Please sign in to comment.