-
Notifications
You must be signed in to change notification settings - Fork 29.7k
catch StateError thrown from Chromium.close
#154366
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
catch StateError thrown from Chromium.close
#154366
Conversation
| }) async { | ||
| try { | ||
| return asyncGuard(() => chromeConnection.getTab(accept, retryFor: retryFor)); | ||
| } on IOException catch (error, stackTrace) { |
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.
Maybe this should just be a blanket on (e) catch, but I'm being conservative.
| return !chromeTab.url.startsWith('chrome-extension'); | ||
| }, | ||
| retryFor: const Duration(seconds: 5), | ||
| onError: (Object error, StackTrace stackTrace) { |
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.
does this now mean we're swallowing all errors?
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.
oh, it looks like this only gets delegated IOException and StateError?
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.
oh yeah. Anything that's not IOException or StateError will fall through. Maybe it should just catch everything.
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.
Addressed in refactor: add clarifying docs. I decided to just rename the parameter to not imply that any error would be caught.
| } on FormatException catch (ex) { | ||
| _logger.printError('Caught FormatException: $ex'); | ||
| return shelf.Response.ok('Caught exception: $ex'); | ||
| } on IOException catch (ex) { |
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.
Why are we not catching this here?
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 catch was introduced recently, but before I introduced getChromeTabGuarded. getChromeTabGuarded should already catch this.
christopherfujino
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
Fixes crasher flutter#154203. Also does a little refactoring to move exception handling into the `getChromeTabGuarded` utility function. I plan on cherry-picking a subset of this change. This would be included in the custom CP patch for flutter#153064.
…ction.getTab` (#154380) This is a custom hotfix patch to fix #154366 and #153064 on the stable channel. The reason for a custom patch rather than a bot-created PR is that the fixes on master were done by two sequential PRs (#153978 and #154366). This CP patch is also a subset of those changes (calls to Chrome when shutting down at the end of `flutter run -d chrome`).
Fixes crasher #154203.
Also does a little refactoring to move exception handling into the
getChromeTabGuardedutility function.I plan on cherry-picking a subset of this change. This would be included in the custom CP patch for #153064.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.