Commit ae70f7e7930 for nodejs
commit ae70f7e79303e78029b7636dc72716cc349a5e47
Author: Shelley Vohr <shelley.vohr@gmail.com>
Date: Tue Sep 22 13:48:46 2026 +0000
inspector: throw ERR_INSPECTOR_NOT_AVAILABLE without an agent
An Environment created with kNoCreateInspector threw a bare string from
inspector.Session#connect(), inspector.open() and the other Agent entry
points, so callers could not tell the condition apart by error code. Use
the ERR_INSPECTOR_NOT_AVAILABLE code that connectToMainThread() already
throws for the same situation.
Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66239
Refs: https://github.com/nodejs/node/pull/65977
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index ca9b128592d..22506e26b32 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -512,15 +512,8 @@ bool IsFilePath(const std::string& path) {
#endif // __POSIX__
void ThrowUninitializedInspectorError(Environment* env) {
- HandleScope scope(env->isolate());
-
- std::string_view msg =
- "This Environment was initialized without a V8::Inspector";
- Local<Value> exception;
- if (ToV8Value(env->context(), msg, env->isolate()).ToLocal(&exception)) {
- env->isolate()->ThrowException(exception);
- }
- // V8 will have scheduled a superseding error here.
+ THROW_ERR_INSPECTOR_NOT_AVAILABLE(
+ env, "This Environment was initialized without a V8::Inspector");
}
} // namespace