-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Send text error in JSON and print in tools #58284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -187,6 +190,7 @@ class FlutterDevice { | |||
CompileExpression compileExpression, | |||
ReloadMethod reloadMethod, | |||
GetSkSLMethod getSkSLMethod, | |||
PrintErrorEventMethod printErrorEventMethod, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be hooked up somewhere to work, are either of the Hot/Cold runners passing this through?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They both call connectToServiceProtocol
defined on ResidentRunner
in their attach
methods, so that should mean they use the printErrorEventMethod
defined on ResidentRunner
too. Are there other places that need to pass in a print method too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Jonah Williams <jonahwilliams@google.com>
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nit
This reverts commit cce6b3c.
…8284)" (flutter#58872)" This reverts commit c2d5e18.
* Revert "Revert "Send text error in JSON and print in tools (flutter#58284)" (flutter#58872)" This reverts commit c2d5e18. * Put streamListen in try/catch if extension events already listened for
* Send text error in JSON and print in tools * Add test for error text * Fix analysis issues * Move streamListen to try/catch and use global.printStatus * Extract print error fn and listen for events in web runner * Add extension listen request to test * Update packages/flutter_tools/lib/src/resident_runner.dart Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Rename error parsing method * Allow crash if listen for extension stream fails * Add test for error and non-error extension events * Fix formatting for TextTreeRenderer * Use shorter message for second exceptions * Specify types for map * Add empty JSON for resident_web_runner test * Move stream listen to vmservice and add vmservice test * Fix stream type * Move structured error log definition to vmservice * Use correct test matcher isNot Co-authored-by: Jonah Williams <jonahwilliams@google.com>
…lutter#58872) This reverts commit cce6b3c.
* Revert "Revert "Send text error in JSON and print in tools (flutter#58284)" (flutter#58872)" This reverts commit c2d5e18. * Put streamListen in try/catch if extension events already listened for
Description
This is a follow up to #58118.
Currently, calling
flutter run --dart-define=flutter.inspector.structuredErrors=true
on the command line will result in errors not being printed because they are captured as structured errors and sent out as JSON. This change lets flutter_tools display the text of errors.Result if running on phone emulator:
Result if running application on web:
Related Issues
None
Tests
I added the following tests:
resident_web_runner
listens for extension eventsChecklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.