diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2020-01-01 16:42:17 +0100 |
---|---|---|
committer | Beth Griggs <Bethany.Griggs@uk.ibm.com> | 2020-02-06 02:49:35 +0000 |
commit | 7f70c2431c1499e8027b134d3f3e0f5524732ea1 (patch) | |
tree | f641d1e09ec97446778ea5070decb7d6f96f944b | |
parent | fd78d04188cb2228acf8cf89dd21082bedb04cae (diff) | |
download | node-new-7f70c2431c1499e8027b134d3f3e0f5524732ea1.tar.gz |
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>
-rw-r--r-- | lib/internal/util/inspector.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/internal/util/inspector.js b/lib/internal/util/inspector.js index 5f11eff21a..5a95bcf8ea 100644 --- a/lib/internal/util/inspector.js +++ b/lib/internal/util/inspector.js @@ -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(); } } |