Repository navigation
Commit 3d2c811
authored
[flutter_tools] Handle all DartDevelopmentServiceExceptions gracefully in resident web runner (flutter#191183)
## Description
This PR ensures that `ResidentWebRunner` catches all variants of
`DartDevelopmentServiceException` during startup, rather than just
`failedToStartError`.
When DDS fails to establish a WebSocket connection or upgrade the
connection to DWDS (e.g., if the target browser exits prematurely or
rejects the handshake), `package:dds` throws
`DartDevelopmentServiceException.connectionIssue(...)` with `errorCode =
DartDevelopmentServiceException.connectionError` (Code 3), rather than
`failedToStartError` (Code 2).
Previously, `ResidentWebRunner` only caught `failedToStartError` and
rethrew all other `DartDevelopmentServiceException`s, which caused the
CLI to crash with an unhandled top-level exception.
With this change, we catch all `DartDevelopmentServiceException`s, log
the error details with stack trace, perform necessary cleanup, and
gracefully exit via `throwToolExit(kExitMessage)`.
## Related Issues
Fixes flutter#191179
## Tests
Added a new unit test in `resident_web_runner_test.dart`:
- `Does not crash if DDS fails to upgrade WebSocket during startup`1 parent 7c08f43 commit 3d2c811
2 files changed
Lines changed: 29 additions & 5 deletions
File tree
- packages/flutter_tools
- lib/src/isolated
- test/general.shard
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
| 409 | + | |
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
414 | | - | |
| 413 | + | |
| 414 | + | |
415 | 415 | | |
416 | | - | |
| 416 | + | |
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
284 | 308 | | |
285 | 309 | | |
286 | 310 | | |
| |||
0 commit comments