flutter / flutter/devtools

Do not break on exceptions thrown in undebuggable code if caught in undebuggable code

Đang mở
#5,883 20 bình luận 6 reaction 0 người được giao Xem trên GitHub
P2
Ngôn ngữ chính
Dart
Star
1.7k
Fork
404
Merge trung bình
6 ngày 17 giờ
Pull request đã merge (30 ngày)
18

Mô tả

There are several issues where users were confused by the the "Break on all exceptions" option when an exception is thrown in core library code **and handled in core library code**, e.g.
https://github.com/dart-lang/sdk/issues/52615
https://github.com/dart-lang/sdk/issues/52423

I proposed that, by default, if an exception is thrown in code that is not debuggable and will be caught in code that is not debuggable, then the debugger will not break even if "Break on all exceptions" is enabled.

For example:
```dart
part of dart.core

void _foo() {
throw Exception('foo');
}

void bar() {
try {
_foo();
} on Exception {};
}
```

Calling `bar` **should not cause** the debugger to break on `throw Exception('foo');` because the exception is both throw and caught in undebuggable code i.e. it is just an implementation detail of `bar`.

Another example:

```dart
part of dart.core

void _foo() {
throw Exception('foo');
}

void bar() {
_foo();
}

// User code:
void main() {
try {
bar();
} on Exception {}
}
```

Calling `bar` **should cause** the debugger to break on `throw Exception('foo');` because the exception is caught in debuggable code.

This UX will require VM changes.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.