Skip to content

Commit 4656e6a

Browse files
committed
fixup! src: add contextify interceptor debug logs
1 parent 54a8cd9 commit 4656e6a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/debug_utils-inl.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,19 @@ struct ToStringHelper {
6565

6666
static std::string Convert(v8::Local<v8::Value> value) {
6767
v8::Isolate* isolate = v8::Isolate::GetCurrent();
68-
v8::TryCatch scope(isolate);
69-
if (value->IsSymbol()) {
70-
Utf8Value utf8_value(isolate,
71-
value.As<v8::Symbol>()->Description(isolate));
72-
return SPrintF("<Symbol: %s>", utf8_value.ToString());
73-
}
7468
if (value->IsString()) {
7569
Utf8Value utf8_value(isolate, value);
7670
return SPrintF("\"%s\"", utf8_value.ToString());
7771
}
78-
Utf8Value utf8_value(isolate, value);
79-
if (scope.HasCaught()) {
72+
v8::MaybeLocal<v8::String> maybe_detail =
73+
value->ToDetailString(isolate->GetCurrentContext());
74+
v8::Local<v8::String> detail;
75+
if (!maybe_detail.ToLocal(&detail)) {
76+
// This will only occur when terminating. No exception is expected
77+
// with `ToDetailString`.
8078
return "<Unable to stringify v8::Value>";
8179
}
80+
Utf8Value utf8_value(isolate, detail);
8281
return utf8_value.ToString();
8382
}
8483

0 commit comments

Comments
 (0)