Unverified Commit 243222c0 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Include error message in crash reports (#24632)

This modifies our flutter_tools crash reports to include the error
message. This error message may contain personally identifying
information (PII), such as a file system path on the developer's
local machine that may contain user names, project code names,
etc. To disable crash reporting, the developer can run the
following command:

    flutter config --no-analytics

For more information on what gets reported during crashes of the
flutter tool, see:

https://github.com/flutter/flutter/wiki/Flutter-CLI-crash-reporting
parent 280bbefd
...@@ -107,6 +107,7 @@ class CrashReportSender { ...@@ -107,6 +107,7 @@ class CrashReportSender {
req.fields['osVersion'] = os.name; // this actually includes version req.fields['osVersion'] = os.name; // this actually includes version
req.fields['type'] = _kDartTypeId; req.fields['type'] = _kDartTypeId;
req.fields['error_runtime_type'] = '${error.runtimeType}'; req.fields['error_runtime_type'] = '${error.runtimeType}';
req.fields['error_message'] = '$error';
final String stackTraceWithRelativePaths = Chain.parse(stackTrace.toString()).terse.toString(); final String stackTraceWithRelativePaths = Chain.parse(stackTrace.toString()).terse.toString();
req.files.add(http.MultipartFile.fromString( req.files.add(http.MultipartFile.fromString(
......
...@@ -107,6 +107,7 @@ void main() { ...@@ -107,6 +107,7 @@ void main() {
expect(fields['osVersion'], 'fake OS name and version'); expect(fields['osVersion'], 'fake OS name and version');
expect(fields['type'], 'DartError'); expect(fields['type'], 'DartError');
expect(fields['error_runtime_type'], 'StateError'); expect(fields['error_runtime_type'], 'StateError');
expect(fields['error_message'], 'Bad state: Test bad state error');
final BufferLogger logger = context[Logger]; final BufferLogger logger = context[Logger];
expect(logger.statusText, 'Sending crash report to Google.\n' expect(logger.statusText, 'Sending crash report to Google.\n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment