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

Fix incorrect example of error handling in WebClient Javadoc #27645

Closed
wants to merge 1 commit into from

Conversation

filiphr
Copy link
Contributor

@filiphr filiphr commented Nov 5, 2021

No description provided.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 5, 2021
@filiphr filiphr changed the base branch from main to 5.3.x November 6, 2021 07:51
@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Nov 8, 2021
@rstoyanchev rstoyanchev self-assigned this Nov 30, 2021
@rstoyanchev rstoyanchev added type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 30, 2021
@rstoyanchev rstoyanchev added this to the 5.3.14 milestone Nov 30, 2021
@rstoyanchev rstoyanchev changed the title Fix incorrect example for error handling in WebClient exchangeToFlux and exchangeToMono Fix incorrect example of error handling in WebClient Javadoc Nov 30, 2021
@rstoyanchev
Copy link
Contributor

I've updated this slightly differently to just createException since in this example the left-hand side is Mono<Object> but otherwise it could also be cast with the cast operator. Note also that for 6.0 there is a new createErrror method that casts to any type, similar to Mono#error, see #27637.

poutsma added a commit that referenced this pull request Dec 2, 2021
poutsma added a commit that referenced this pull request Dec 2, 2021
createError is not available in 5.3.

See gh-27645
@filiphr filiphr deleted the fix-javadoc branch December 2, 2021 17:04
@filiphr
Copy link
Contributor Author

filiphr commented Dec 2, 2021

Thanks for doing the changes @rstoyanchev. I do understand the reasoning for your adaptation. However, I have to say that the example will still be confusing to people. Most of the time I do not have a Mono<Object> as a return type. My main goal for this came from the fact that I wanted to not have exceptions thrown, but rather handle the error myself.

Nevertheless, hopefully people that are more familiar with the reactive stack will not be confused and will know that they need to do the flat map.

Great about the new createError method.

rstoyanchev added a commit that referenced this pull request Dec 3, 2021
This time showing a more representative example.

See gh-27645
@rstoyanchev
Copy link
Contributor

Fair enough. I've updated 5.3.x to show a more representative sample and in main it shows use of createError already.

@filiphr
Copy link
Contributor Author

filiphr commented Dec 3, 2021

Thanks a lot @rstoyanchev, really appreciate that you are taking into consideration my feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: documentation A documentation task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants