dart-lang / dart-lang/webdev

daemon does not send unhandled exceptions to stdout/stderr

Open
#837 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
224
Forks
94
Avg merge
7h 14m
Merged PRs (30d)
2

Description

If I run `pub global run webdev daemon` to run a web app (I'm using [a copy of the Stagehand Angular sample](https://github.com/Dart-Code/Dart-Code/tree/rename-flutter-web-to-web/src/test/test_projects/web/broken) with [an exception added into the main dart file](https://github.com/Dart-Code/Dart-Code/blob/f66e8b275577011f362307f8ee62da9ee2933fdf/src/test/test_projects/web/broken/lib/src/todo_list/todo_list_component.dart#L37)) the exception is never printed in the daemon output.

This means when running from the IDE, the error never shows up in the debug console.

```
[{"event":"daemon.log","params":{"log":"[INFO] Debug service listening on ws://127.0.0.1:54984/qGXfwLlrIKI=\n"}}]
[{"event":"app.start","params":{"appId":"ShDLM17zRk4P+qJugvEy1w==","directory":"/Users/dantup/Dev/Dart-Code/src/test/test_projects/web/broken","deviceId":"chrome","launchMode":"run"}}]
[{"event":"app.started","params":{"appId":"ShDLM17zRk4P+qJugvEy1w=="}}]
[{"event":"app.debugPort","params":{"appId":"ShDLM17zRk4P+qJugvEy1w==","port":54984,"wsUri":"ws://127.0.0.1:54984/qGXfwLlrIKI="}}]

^C[{"event":"app.log","params":{"appId":"ShDLM17zRk4P+qJugvEy1w==","log":"Lost connection to device."}}]
[{"event":"app.stop","params":{"appId":"ShDLM17zRk4P+qJugvEy1w=="}}]
[{"event":"daemon.log","params":{"log":"[INFO] Stopped debug service on ws://127.0.0.1:54984\n"}}]
```

I think this works ok for Flutter web apps, but I think that could be because the Flutter framework catches all exceptions to print its own formatted errors.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `pub global run webdev daemon` using the linked broken Angular sample and the exception in `todo_list_component.dart`. Trace how the daemon reports application output after startup; done means unhandled exceptions appear in the daemon's stdout/stderr or emitted app log so the IDE debug console can show them.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
cli, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.