-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Catch exceptions thrown by runChecked* when possible #36109
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
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception. Reviewers: Read the Tree Hygine page and make sure this patch meets those guidelines before LGTMing. /cc @dnfield |
9b2983b to
c1f06a9
Compare
|
This PR isn't changing behavior. |
Codecov Report
@@ Coverage Diff @@
## master #36109 +/- ##
==========================================
- Coverage 54.95% 54.72% -0.23%
==========================================
Files 187 187
Lines 17248 17260 +12
==========================================
- Hits 9478 9445 -33
- Misses 7770 7815 +45
Continue to review full report at Codecov.
|
jonahwilliams
left a comment
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.
We should still have tests to confirm that we're catch the exceptions we think we are, and responding appropriately
| await runAdbCheckedAsync(<String>[ | ||
| 'shell', 'echo', '-n', _getSourceSha1(app), '>', _getDeviceSha1Path(app), | ||
| ]); | ||
| } catch (error) { |
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.
Catch ProcessException only here and below.
| output = runAdbCheckedSync(<String>[ | ||
| 'shell', '-x', 'logcat', '-v', 'time', '-t', '1', | ||
| ]); | ||
| } catch (error) { |
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 should also catch ProcessException only, but that likely requires modifying _runWithLoggingSync in process.dart to throw a ProcessException instead of a String.
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.
I filed #36242. What about we change exception type in a separate PR?
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.
Sure, if you think that will make that change easier.
f86f5ab to
db9923f
Compare
zanderso
left a comment
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 on green
db9923f to
12e56e3
Compare
jonahwilliams
left a comment
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!
Description
Catch the exceptions when possible.
Related Issues
#35929
Checklist
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
Does your PR require Flutter developers to manually update their apps to accommodate your change?