From 244d8643813e66f4f9e426194dc13ef2143a5c4e Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 25 Apr 2019 15:08:53 -0700 Subject: [PATCH] Log the sticky error during isolate shutdown (flutter/engine#8742) The sticky error may be set in cases such as an unhandled asynchronous exception. This is similar to the logging done in the Dart command line embedder's isolate shutdown callback. --- engine/src/flutter/runtime/dart_isolate.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/src/flutter/runtime/dart_isolate.cc b/engine/src/flutter/runtime/dart_isolate.cc index 7aa191c7d7..345792cadf 100644 --- a/engine/src/flutter/runtime/dart_isolate.cc +++ b/engine/src/flutter/runtime/dart_isolate.cc @@ -791,6 +791,14 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) { } void DartIsolate::OnShutdownCallback() { + { + tonic::DartApiScope api_scope; + Dart_Handle sticky_error = Dart_GetStickyError(); + if (!Dart_IsNull(sticky_error) && !Dart_IsFatalError(sticky_error)) { + FML_LOG(ERROR) << Dart_GetError(sticky_error); + } + } + shutdown_callbacks_.clear(); if (isolate_shutdown_callback_) { isolate_shutdown_callback_();