Throw wrapped TimeoutException on Mono.block* and Flux.block*#3733
Merged
chemicL merged 2 commits intoreactor:mainfrom Mar 5, 2024
Merged
Throw wrapped TimeoutException on Mono.block* and Flux.block*#3733chemicL merged 2 commits intoreactor:mainfrom
TimeoutException on Mono.block* and Flux.block*#3733chemicL merged 2 commits intoreactor:mainfrom
Conversation
Throw wrapped `TimeoutException` on `Mono.block*` and `Flux.block*` so that user can use this when timeout instead of digging into IllegalStateException message. Fixes reactor#3709.
injae-kim
commented
Feb 22, 2024
Comment on lines
+128
to
+129
| String errorMessage = "Timeout on blocking read for " + timeout + " " + unit; | ||
| throw new IllegalStateException(errorMessage, new TimeoutException(errorMessage)); |
Contributor
Author
There was a problem hiding this comment.
I checked that Mono#block(timeout), Flux#blockFirst(timeout), Flux#blockLast(timeout) use this code~!
Contributor
Author
There was a problem hiding this comment.
// AS-IS
If the provided timeout expires, a {@link RuntimeException} is thrown.
// TO-BE
If the provided timeout expires, a {@link RuntimeException} is thrown with {@link TimeoutException} as the cause.
(just curiosity) should we enhance document on Mono#block*, Flux#block* like above?
Contributor
Author
There was a problem hiding this comment.
✅ update javadoc :)
injae-kim
commented
Feb 22, 2024
Comment on lines
+152
to
+153
| String errorMessage = "Timeout on blocking read for " + timeout + " " + unit; | ||
| throw new IllegalStateException(errorMessage, new TimeoutException(errorMessage)); |
Contributor
Author
There was a problem hiding this comment.
I checked that Mono.blockOptional(timeout) use this code~!
chemicL
requested changes
Mar 4, 2024
Member
chemicL
left a comment
There was a problem hiding this comment.
Thanks @injae-kim ! Great job. Do you mind adding the bit about the cause to the javadocs as you suggested?
Comment on lines
+128
to
+129
| String errorMessage = "Timeout on blocking read for " + timeout + " " + unit; | ||
| throw new IllegalStateException(errorMessage, new TimeoutException(errorMessage)); |
He-Pin
reviewed
Mar 4, 2024
| .isThrownBy(() -> source.blockOptional(Duration.ofNanos(100))) | ||
| .withMessage("Timeout on blocking read for 100 NANOSECONDS"); | ||
| .withMessage("Timeout on blocking read for 100 NANOSECONDS") | ||
| .withCause(new TimeoutException("Timeout on blocking read for 100 NANOSECONDS")); |
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.
Throw wrapped
TimeoutExceptiononMono.block*andFlux.block*so that user can use this when timeout instead of digging into IllegalStateException message.Fixes #3709.