-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Add method to ClientResponse that returns Mono terminating with createException #27637
Comments
I can see the point for having a different exception, but can't you just |
@poutsma Isn't In many cases, a returning value of Mono<RESULT> mono = clientResponse.createException().flatMap(e -> Mono.error(new MyException("message", e))); I wish I could just write it down as the following. Mono<RESULT> mono = clientResponse.createError().onErrorMap(e -> new MyException("message", e)); |
There is a related example in #27645 that doesn't even involve changing the exception. If you use It would make sense to align |
Personally I prefer the explicitness that the That said, by looking at #27645, I realise that the current signature is not ideal either and requires the use of a |
The method
ClientResponse.createException()
returns theMono<WebClientResponseException>
type.Mono<Exception>
feels likeEither<Exception, Exception>
. I think that theMono<RESULT>
type is actually needed. So, what if there is thecreateError
method that returns theMono<RESULT>
type in theClientResponse
interface?The text was updated successfully, but these errors were encountered: