Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 75e15a454196573fce28a438032a7fe68e966ddb..b077a70f6b90aa1ae679c9802f8ed8faeb343622 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -1138,6 +1138,14 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) { |
stack_trace_for_uncaught_exceptions_options_); |
} |
} |
+ // Stringify custom error objects for the message object. |
+ if (exception_handle->IsJSObject() && !IsErrorObject(exception_handle)) { |
+ bool failed = false; |
+ exception_handle = Execution::ToString(exception_handle, &failed); |
+ if (failed) { |
+ exception_handle = factory()->LookupAsciiSymbol("exception"); |
+ } |
+ } |
Handle<Object> message_obj = MessageHandler::MakeMessageObject( |
"uncaught_exception", |
location, |