Repository navigation
[flutter_tools] Catch exceptions when starting Chrome to launch DevTools - #191215
Merged
Merged
Conversation
If Google Chrome is not installed, attempting to launch DevTools throws a ProcessException from Chrome.start. Because this call was unawaited and unhandled, it caused the flutter tool to crash. Fixes: flutter#182307
Contributor
There was a problem hiding this comment.
Code Review
This pull request wraps the browser-launching logic in a try-catch block to handle and log exceptions when startChrome fails, and adds a unit test to verify this behavior. The review feedback suggests refactoring the immediately invoked asynchronous function expression (IIFE) into a named local helper function to improve code readability.
chingjun
approved these changes
Aug 18, 2026
This was referenced Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
If Google Chrome is not installed, attempting to launch DevTools throws a
ProcessExceptionfromChrome.start. Because this call was unawaited and unhandled, it caused the flutter tool to crash.This change wraps the
startChromeinvocation in a try-catch block to gracefully catchExceptions and log the error message vialogger.printErrorinstead of crashing.Related Issues
Fixes #182307
Tests
launchDevToolsInBrowser handles startChrome failureinpackages/flutter_tools/test/general.shard/proxied_devices/proxied_devices_test.dart.