diff --git a/native_mate/arguments.cc b/native_mate/arguments.cc index ad62e207f84..47915dd4265 100644 --- a/native_mate/arguments.cc +++ b/native_mate/arguments.cc @@ -11,16 +11,13 @@ namespace mate { namespace { -std::string V8TypeAsString(v8::Local value) { +std::string V8TypeAsString(v8::Isolate* isolate, v8::Local value) { if (value.IsEmpty()) return ""; - if (value->IsUndefined()) - return "undefined"; - if (value->IsNull()) - return "null"; + v8::MaybeLocal details = value->ToDetailString(isolate); std::string result; - if (!ConvertFromV8(NULL, value, &result)) - return std::string(); + if (!details.IsEmpty()) + ConvertFromV8(isolate, details.ToLocalChecked(), &result); return result; } @@ -55,7 +52,7 @@ v8::Local Arguments::ThrowError() const { return ThrowTypeError(base::StringPrintf( "Error processing argument at index %d, conversion failure from %s", - next_, V8TypeAsString((*info_)[next_]).c_str())); + next_, V8TypeAsString(isolate_, (*info_)[next_]).c_str())); } v8::Local Arguments::ThrowError(const std::string& message) const {