Chromium Code Reviews| Index: runtime/vm/isolate.cc |
| diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
| index e0f8752c1d1ec4c1c163e4bcfd46bf6fec605b11..f4744ff7230ffe8880eec58ed06303a30e8b1d09 100644 |
| --- a/runtime/vm/isolate.cc |
| +++ b/runtime/vm/isolate.cc |
| @@ -569,10 +569,16 @@ bool IsolateMessageHandler::ProcessUnhandledException(const Error& result) { |
| } else { |
| exc_str = String::New(result.ToErrorCString()); |
| } |
| - I->NotifyErrorListeners(exc_str, stacktrace_str); |
| + bool has_listener = I->NotifyErrorListeners(exc_str, stacktrace_str); |
| if (I->ErrorsFatal()) { |
| - I->object_store()->set_sticky_error(result); |
| + if (has_listener) { |
| + const String& msg = String::Handle(String::New("isolate terminated")); |
| + const UnwindError& error = UnwindError::Handle(UnwindError::New(msg)); |
| + I->object_store()->set_sticky_error(error); |
|
Ivan Posva
2015/08/14 05:18:30
If we have notified the listener, then we can just
|
| + } else { |
| + I->object_store()->set_sticky_error(result); |
| + } |
| return false; |
| } |
| return true; |
| @@ -1203,11 +1209,11 @@ void Isolate::RemoveErrorListener(const SendPort& listener) { |
| } |
| -void Isolate::NotifyErrorListeners(const String& msg, |
| +bool Isolate::NotifyErrorListeners(const String& msg, |
| const String& stacktrace) { |
| const GrowableObjectArray& listeners = GrowableObjectArray::Handle( |
| this, this->object_store()->error_listeners()); |
| - if (listeners.IsNull()) return; |
| + if (listeners.IsNull()) return false; |
| const Array& arr = Array::Handle(this, Array::New(2)); |
| arr.SetAt(0, msg); |
| @@ -1224,6 +1230,7 @@ void Isolate::NotifyErrorListeners(const String& msg, |
| PortMap::PostMessage(msg); |
| } |
| } |
| + return listeners.Length() > 0; |
| } |