fix(error): detect timeouts wrapped in body decode errors - #3064
Merged
seanmonstar merged 1 commit intoJul 13, 2026
Merged
Conversation
Owner
|
Thanks for the PR! I kind of feel like it should still wrap the error in "decode", because the error happened while decoding the body. An alternative would be to just make |
Contributor
Author
|
Thanks for the feedback, let me see how i can improve this! |
raphaelroshan
marked this pull request as ready for review
July 6, 2026 07:04
When a read/total timeout fired while streaming the response body, the error is wrapped as a decode error (Kind::Decode), so is_timeout() did not report it even though a timeout was the underlying cause. Make is_timeout() also recurse into a nested reqwest::Error while walking the source chain, so a timeout wrapped in a decode error is still detected. The error keeps its decode kind (it did happen while decoding the body). Closes seanmonstar#2839
raphaelroshan
force-pushed
the
fix-2839-body-timeout-error
branch
from
July 8, 2026 13:42
10e301a to
5446168
Compare
Contributor
Author
|
@seanmonstar I've updated it based on your feedback, its now a small change touching is_timeout(). Updated the tests as well |
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.
Closes #2839.
When a read or total timeout fires while streaming the response body, the error is wrapped as a decode error (
Kind::Decode), sois_timeout()didn't report it even though a timeout was the underlying cause — andis_decode()was true with the message "error decoding response body", which is misleading.Per review feedback, this keeps the decode kind (the error did happen while decoding the body) and instead makes
is_timeout()recurse into a nestedreqwest::Errorwhile walking the source chain. So a timeout wrapped in a decode error is now correctly reported byis_timeout(), whileis_decode()stays true.Added unit tests covering a body timeout wrapped by
decode(bothis_decode()andis_timeout()are true) and that an unrelated decode error is not a timeout.