Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-03-22 19:07:46 +0300
committerJoyee Cheung <joyeec9h3@gmail.com>2019-03-30 07:38:55 +0300
commit61ef9df958f98bed5159d9d4553ea5b2f894272f (patch)
tree56870622ad9f6546a582fc53fd602fff37dbf373 /src/inspector_agent.cc
parent7aad63ba349d7b9b0eda4149d236ee66e5a26401 (diff)
inspector: display error when ToggleAsyncHook fails
This patch refactors `AppendExceptionLine` and `PrintSyncTrace` to reuse the error formatting logic and use them to print uncaught error in ``ToggleAsyncHook` PR-URL: https://github.com/nodejs/node/pull/26859 Refs: https://github.com/nodejs/node/issues/26798 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/inspector_agent.cc')
-rw-r--r--src/inspector_agent.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index 91a57b9944e..57228ed9533 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -839,11 +839,12 @@ void Agent::ToggleAsyncHook(Isolate* isolate,
HandleScope handle_scope(isolate);
CHECK(!fn.IsEmpty());
auto context = parent_env_->context();
- auto result = fn.Get(isolate)->Call(context, Undefined(isolate), 0, nullptr);
- if (result.IsEmpty()) {
- FatalError(
- "node::inspector::Agent::ToggleAsyncHook",
- "Cannot toggle Inspector's AsyncHook, please report this.");
+ v8::TryCatch try_catch(isolate);
+ USE(fn.Get(isolate)->Call(context, Undefined(isolate), 0, nullptr));
+ if (try_catch.HasCaught()) {
+ PrintCaughtException(isolate, context, try_catch);
+ FatalError("\nnode::inspector::Agent::ToggleAsyncHook",
+ "Cannot toggle Inspector's AsyncHook, please report this.");
}
}