Skip to content

Conversation

@aam
Copy link
Member

@aam aam commented Jun 7, 2019

One example of unreported errors is #33938 where adb is invoked when broadcast stream is created in a _start callback

@aam aam added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 7, 2019
Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test?

}
return 0;
String getVersion() => flutterVersion ?? FlutterVersion.instance.getVersionString(redactUnknownBranches: true);
return runZoned<Future<int>>(() async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: return await runZoned...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

error, stackTrace, verbose, args, reportCrashes, getVersion);
}
}, onError: (Object error, StackTrace stackTrace) async {
await _handleToolError(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make the outer call to runZoned() return null, correct? Should we wrap that null in a non-zero synthetic exit code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so: _handleToolError invoked from this onError handler will terminate the flutter with exit code derived from what kind error the error is(ToolExit, ProcessExit, something unexpected).

If we end up in onError, then runZoned() returned a future that never completes because of unhandled exception.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll call exit(), but that can be overridden for tests. I'm just curious what the return value of run() will be in that case.

Copy link
Member Author

@aam aam Jun 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only end up in onError through async callback/flow, and that flow won't affect runZoned return-value. We might have used Completer or something similar to communicate between this callback and method that runZoned is executing, but that seems unnecessary - we can simply exit the tool.

}
return 0;
String getVersion() => flutterVersion ?? FlutterVersion.instance.getVersionString(redactUnknownBranches: true);
return await runZoned<Future<int>>(() async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should replicate the case this is guarding against in a test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@aam
Copy link
Member Author

aam commented Jun 10, 2019

Test?

Added.

Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aam aam merged commit d917978 into flutter:master Jun 10, 2019
@aam aam deleted the report-async-errors branch June 10, 2019 16:52
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants