fix: Catch sync/async* exceptions in interceptor's handlers#2139
Merged
fix: Catch sync/async* exceptions in interceptor's handlers#2139
Conversation
Signed-off-by: CaiJingLong <cjl_spy@163.com>
Signed-off-by: CaiJingLong <cjl_spy@163.com>
Signed-off-by: CaiJingLong <cjl_spy@163.com>
Signed-off-by: CaiJingLong <cjl_spy@163.com>
Signed-off-by: CaiJingLong <cjl_spy@163.com>
Member
|
Should we be more explicit about this and also change the return type of the |
Member
We can keep those as long as Dart can recognize them, IMO. :D |
ea87715 to
e1399ce
Compare
Member
|
Looks like the |
Member
I think this is related to the change of the return type to |
7 tasks
AlexV525
added a commit
that referenced
this pull request
Mar 28, 2024
Reverts #2139 Fixes #2167 Reopen #2138 ### New Pull Request Checklist - [x] I have read the [Documentation](https://pub.dev/documentation/dio/latest/) - [x] I have searched for a similar pull request in the [project](https://github.com/cfug/dio/pulls) and found none - [x] I have updated this branch with the latest `main` branch to avoid conflicts (via merge from master or rebase) - [ ] I have added the required tests to prove the fix/feature I'm adding - [x] I have updated the documentation (if necessary) - [x] I have run the tests without failures - [x] I have updated the `CHANGELOG.md` in the corresponding package ### Additional context and info (if any) Added tests were fake, so they remained effective after the revert.
7 tasks
ersanKolay
added a commit
to ersanKolay/dio
that referenced
this pull request
Mar 11, 2026
When an interceptor overrides onRequest/onResponse/onError with an async implementation that throws after an await, the handler's Completer is never completed and the request hangs indefinitely. Wrap interceptor callback invocations in a forked Zone with a custom handleUncaughtError that rejects/advances the handler when an uncaught async error occurs. Unlike the reverted PR cfug#2139, this approach does not await the callback and preserves the original microtask ordering, avoiding the regression from cfug#2167. Fixes cfug#2138
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2138
New Pull Request Checklist
mainbranch to avoid conflicts (via merge from master or rebase)CHANGELOG.mdin the corresponding package