From 243222c00d3eb1bf245ef6d7e9f0e6058c055b87 Mon Sep 17 00:00:00 2001 From: Todd Volkert Date: Mon, 10 Dec 2018 13:59:47 -0800 Subject: [PATCH] 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 --- packages/flutter_tools/lib/src/crash_reporting.dart | 1 + packages/flutter_tools/test/crash_reporting_test.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/flutter_tools/lib/src/crash_reporting.dart b/packages/flutter_tools/lib/src/crash_reporting.dart index ae1327f2d3..3336c1ea27 100644 --- a/packages/flutter_tools/lib/src/crash_reporting.dart +++ b/packages/flutter_tools/lib/src/crash_reporting.dart @@ -107,6 +107,7 @@ class CrashReportSender { req.fields['osVersion'] = os.name; // this actually includes version req.fields['type'] = _kDartTypeId; req.fields['error_runtime_type'] = '${error.runtimeType}'; + req.fields['error_message'] = '$error'; final String stackTraceWithRelativePaths = Chain.parse(stackTrace.toString()).terse.toString(); req.files.add(http.MultipartFile.fromString( diff --git a/packages/flutter_tools/test/crash_reporting_test.dart b/packages/flutter_tools/test/crash_reporting_test.dart index efbbf211e9..7152ba5b78 100644 --- a/packages/flutter_tools/test/crash_reporting_test.dart +++ b/packages/flutter_tools/test/crash_reporting_test.dart @@ -107,6 +107,7 @@ void main() { expect(fields['osVersion'], 'fake OS name and version'); expect(fields['type'], 'DartError'); expect(fields['error_runtime_type'], 'StateError'); + expect(fields['error_message'], 'Bad state: Test bad state error'); final BufferLogger logger = context[Logger]; expect(logger.statusText, 'Sending crash report to Google.\n'