summaryrefslogtreecommitdiff
path: root/src/inspector_agent.cc
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-03-23 00:07:46 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-03-30 00:38:55 -0400
commit61ef9df958f98bed5159d9d4553ea5b2f894272f (patch)
tree56870622ad9f6546a582fc53fd602fff37dbf373 /src/inspector_agent.cc
parent7aad63ba349d7b9b0eda4149d236ee66e5a26401 (diff)
downloadandroid-node-v8-61ef9df958f98bed5159d9d4553ea5b2f894272f.tar.gz
android-node-v8-61ef9df958f98bed5159d9d4553ea5b2f894272f.tar.bz2
android-node-v8-61ef9df958f98bed5159d9d4553ea5b2f894272f.zip
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 91a57b9944..57228ed953 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.");
}
}