aboutsummaryrefslogtreecommitdiff
path: root/lib/inspector.js
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-03-16 09:17:58 +0100
committerMichaël Zasso <targos@protonmail.com>2018-03-22 08:24:31 +0100
commit4e1f0907dae9916215985a9f81bf3dec1eeaeaef (patch)
tree32f5784431d3052ec769a3e24cb82d0b59809a81 /lib/inspector.js
parent258bcb9bffb1824d65a76eb30fcd0adda0f753a0 (diff)
downloadandroid-node-v8-4e1f0907dae9916215985a9f81bf3dec1eeaeaef.tar.gz
android-node-v8-4e1f0907dae9916215985a9f81bf3dec1eeaeaef.tar.bz2
android-node-v8-4e1f0907dae9916215985a9f81bf3dec1eeaeaef.zip
inspector: migrate errors from C++ to JS
Assign a code to a user-facing error. Turn other internal-only errors to checks. PR-URL: https://github.com/nodejs/node/pull/19387 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/inspector.js')
-rw-r--r--lib/inspector.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/inspector.js b/lib/inspector.js
index 157ca28632..3285c1040a 100644
--- a/lib/inspector.js
+++ b/lib/inspector.js
@@ -30,9 +30,13 @@ class Session extends EventEmitter {
connect() {
if (this[connectionSymbol])
- throw new ERR_INSPECTOR_ALREADY_CONNECTED();
- this[connectionSymbol] =
- new Connection((message) => this[onMessageSymbol](message));
+ throw new ERR_INSPECTOR_ALREADY_CONNECTED('The inspector session');
+ const connection =
+ new Connection((message) => this[onMessageSymbol](message));
+ if (connection.sessionAttached) {
+ throw new ERR_INSPECTOR_ALREADY_CONNECTED('Another inspector session');
+ }
+ this[connectionSymbol] = connection;
}
[onMessageSymbol](message) {