Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape from uncaught exceptions for IDEs #2104

Merged
merged 4 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ See the [Migration Guide][] for the complete breaking changes list.**
- Fix cancellation for streamed responses and downloads when using `IOHttpClientAdapter`.
- Fix receive progress for streamed responses and downloads when using `IOHttpClientAdapter`.
- Support relative `baseUrl` on the Web platform.
- Fix `Excpetions` getting treated as `Uncaught` during debugging
AlexV525 marked this conversation as resolved.
Show resolved Hide resolved

## 5.4.0

Expand Down
13 changes: 7 additions & 6 deletions dio/lib/src/dio_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,14 @@ abstract class DioMixin implements Dio {
requestInterceptorWrapper((
RequestOptions reqOpt,
RequestInterceptorHandler handler,
) {
) async {
requestOptions = reqOpt;
_dispatchRequest<T>(reqOpt)
.then((value) => handler.resolve(value, true))
.catchError((e) {
handler.reject(e as DioException, true);
});
try {
final value = await _dispatchRequest<T>(reqOpt);
handler.resolve(value, true);
} on DioException catch (e) {
handler.reject(e, true);
}
}),
);

Expand Down