[flutter_tools] dont let crash reporter crash tool (#66755)

package:http can throw a ClientException, which the crash reporter must catch or the tool will crash in the crash reporter. 3/4 crash on dev.
This commit is contained in:
Jonah Williams
2020-09-30 15:26:25 -07:00
committed by GitHub
parent 0f90747bb3
commit b6768ec7a6
2 changed files with 20 additions and 1 deletions

View File

@@ -183,6 +183,25 @@ void main() {
expect(logger.errorText, contains('Failed to send crash report due to a network error'));
});
testWithoutContext('should print an explanatory message when there is a ClientException', () async {
final CrashReportSender crashReportSender = CrashReportSender(
client: CrashingCrashReportSender(const HttpException('no internets')),
usage: mockUsage,
platform: platform,
logger: logger,
operatingSystemUtils: operatingSystemUtils,
);
await crashReportSender.sendReport(
error: ClientException('Test bad state error'),
stackTrace: null,
getFlutterVersion: () => 'test-version',
command: 'crash',
);
expect(logger.errorText, contains('Failed to send crash report due to a network error'));
});
testWithoutContext('should send only one crash report when sent many times', () async {
final RequestInfo requestInfo = RequestInfo();