dart-lang / dart-lang/webdev

Exceptions in Dart web apps pause with "PauseInterrupted" instead of "PauseException"

Open
#2,381 0 comments 0 reactions 0 assignees View on GitHub
P3 package:dwds triaged
Dominant language
Dart
Stars
224
Forks
94
Avg merge
4d 3h
Merged PRs (30d)
2

Description

Given a simple Dart web app created with `dart create -t web` and the code updated to:

```dart
import 'dart:html';

Future main() async {
// TODO: Remove this delay when breakpoints in startup code work
// https://github.com/dart-lang/webdev/issues/830
await Future.delayed(const Duration(seconds: 1));

methodThatThrows();
querySelector('#output')!.text = 'Your Dart app is running.';
}

void methodThatThrows() {
throw Exception("Oops");
}
```

When the exception is triggered, the pause event is `PauseInterrupted` instead of `PauseException`:

```js
{
"jsonrpc": "2.0",
"method": "streamNotify",
"params": {
"streamId": "Debug",
"event": {
"type": "Event",
"kind": "PauseInterrupted",
"timestamp": 1709810801870,
"isolate": {
"type": "@Isolate",
"id": "1",
"number": "1",
"name": "main()",
"isSystemIsolate": false,
"isolateGroupId": ""
},
"topFrame": {
"type": "Frame",
"index": 21,
"code": {
"type": "@Code",
"id": "3",
"name": "main$",
"kind": "Dart"
},
"location": {
"type": "SourceLocation",
"script": {
"type": "@Script",
"id": "2",
"uri": "org-dartlang-app:///web/main.dart"
},
"tokenPos": 1339,
"line": 6,
"column": 16
},
"kind": "AsyncCausal"
}
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with a Dart app created using `dart create -t web`, using `web/main.dart` and the `methodThatThrows` entry point shown in the report. Inspect the Debug stream event handling in webdev to determine why the exception produces `PauseInterrupted` rather than `PauseException`; done means the same reproduction emits the expected pause event.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.