Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
b1e99182
Unverified
Commit
b1e99182
authored
4 years ago
by
Jonah Williams
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move async guard wrapping of crash reporter up a level (#73877)
parent
da90156f
stable
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
28 deletions
+30
-28
runner.dart
packages/flutter_tools/lib/runner.dart
+19
-14
crash_reporting.dart
...ages/flutter_tools/lib/src/reporting/crash_reporting.dart
+11
-13
reporting.dart
packages/flutter_tools/lib/src/reporting/reporting.dart
+0
-1
No files found.
packages/flutter_tools/lib/runner.dart
View file @
b1e99182
...
...
@@ -5,10 +5,11 @@
import
'dart:async'
;
import
'package:args/command_runner.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:intl/intl.dart'
as
intl
;
import
'package:intl/intl_standalone.dart'
as
intl_standalone
;
import
'package:http/http.dart'
as
http
;
import
'src/base/async_guard.dart'
;
import
'src/base/common.dart'
;
import
'src/base/context.dart'
;
import
'src/base/file_system.dart'
;
...
...
@@ -131,19 +132,23 @@ Future<int> _handleToolError(
// Report to both [Usage] and [CrashReportSender].
globals
.
flutterUsage
.
sendException
(
error
);
final
CrashReportSender
crashReportSender
=
CrashReportSender
(
client:
http
.
Client
(),
usage:
globals
.
flutterUsage
,
platform:
globals
.
platform
,
logger:
globals
.
logger
,
operatingSystemUtils:
globals
.
os
,
);
await
crashReportSender
.
sendReport
(
error:
error
,
stackTrace:
stackTrace
,
getFlutterVersion:
getFlutterVersion
,
command:
args
.
join
(
' '
),
);
await
asyncGuard
(()
async
{
final
CrashReportSender
crashReportSender
=
CrashReportSender
(
client:
http
.
Client
(),
usage:
globals
.
flutterUsage
,
platform:
globals
.
platform
,
logger:
globals
.
logger
,
operatingSystemUtils:
globals
.
os
,
);
await
crashReportSender
.
sendReport
(
error:
error
,
stackTrace:
stackTrace
,
getFlutterVersion:
getFlutterVersion
,
command:
args
.
join
(
' '
),
);
},
onError:
(
dynamic
error
)
{
globals
.
printError
(
'Error sending crash report:
$error
'
);
});
globals
.
printError
(
'Oops; flutter has exited unexpectedly: "
$error
".'
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/reporting/crash_reporting.dart
View file @
b1e99182
...
...
@@ -175,19 +175,17 @@ class CrashReportSender {
filename:
_kStackTraceFilename
,
));
// package:http may throw unhandled async exceptions into the Zone.
await
asyncGuard
(()
async
{
final
http
.
StreamedResponse
resp
=
await
_client
.
send
(
req
);
if
(
resp
.
statusCode
==
HttpStatus
.
ok
)
{
final
String
reportId
=
await
http
.
ByteStream
(
resp
.
stream
)
.
bytesToString
();
_logger
.
printTrace
(
'Crash report sent (report ID:
$reportId
)'
);
_crashReportSent
=
true
;
}
else
{
_logger
.
printError
(
'Failed to send crash report. Server responded with HTTP status code
${resp.statusCode}
'
);
}
});
final
http
.
StreamedResponse
resp
=
await
_client
.
send
(
req
);
if
(
resp
.
statusCode
==
HttpStatus
.
ok
)
{
final
String
reportId
=
await
http
.
ByteStream
(
resp
.
stream
)
.
bytesToString
();
_logger
.
printTrace
(
'Crash report sent (report ID:
$reportId
)'
);
_crashReportSent
=
true
;
}
else
{
_logger
.
printError
(
'Failed to send crash report. Server responded with HTTP status code
${resp.statusCode}
'
);
}
// Catch all exceptions to print the message that makes clear that the
// crash logger crashed.
}
catch
(
sendError
,
sendStackTrace
)
{
// ignore: avoid_catches_without_on_clauses
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/reporting/reporting.dart
View file @
b1e99182
...
...
@@ -13,7 +13,6 @@ import 'package:meta/meta.dart';
import
'package:package_config/package_config.dart'
;
import
'package:usage/usage_io.dart'
;
import
'../base/async_guard.dart'
;
import
'../base/error_handling_io.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment