Skip to content

Commit

Permalink
Log the sticky error during isolate shutdown (flutter#8742)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jason-simmons authored Apr 25, 2019
1 parent 0c9c293 commit 1502300
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions runtime/dart_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_();
Expand Down

0 comments on commit 1502300

Please sign in to comment.