From 7f70c2431c1499e8027b134d3f3e0f5524732ea1 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Wed, 1 Jan 2020 16:42:17 +0100 Subject: [PATCH] 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 Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat --- lib/internal/util/inspector.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/internal/util/inspector.js b/lib/internal/util/inspector.js index 5f11eff21a2a15..5a95bcf8ea852a 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(); } }