Skip to content

Commit 5f4be17

Browse files
codebytereaduh95
authored andcommitted
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: #66239 Refs: #65977 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent f725b54 commit 5f4be17

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

‎src/inspector_agent.cc‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,8 @@ bool IsFilePath(const std::string& path) {
512512
#endif // __POSIX__
513513

514514
void ThrowUninitializedInspectorError(Environment* env) {
515-
HandleScope scope(env->isolate());
516-
517-
std::string_view msg =
518-
"This Environment was initialized without a V8::Inspector";
519-
Local<Value> exception;
520-
if (ToV8Value(env->context(), msg, env->isolate()).ToLocal(&exception)) {
521-
env->isolate()->ThrowException(exception);
522-
}
523-
// V8 will have scheduled a superseding error here.
515+
THROW_ERR_INSPECTOR_NOT_AVAILABLE(
516+
env, "This Environment was initialized without a V8::Inspector");
524517
}
525518

526519
} // namespace

0 commit comments

Comments
 (0)