From a08c3b001e06d8d284d065c71ac7c7c480347a93 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 --- 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(); } }