lib: do not catch user errors

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: https://github.com/nodejs/node/pull/31133

PR-URL: https://github.com/nodejs/node/pull/31159
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Ruben Bridgewater authored and Rich Trott committed 2020-01-04 09:04:37 -08:00
1 parent 36c212e25e
commit 904a81d235
1 file changed
+4 -8
+4 -8
View File
@@ -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();
}
}