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

WebTestClient.bindToRouterFunction(...) with exception handler not working [SPR-17239] #21772

Closed
spring-issuemaster opened this issue Sep 3, 2018 · 1 comment
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Sep 3, 2018

rodolphocouto opened SPR-17239 and commented

This bug occurs when the WebTestClient is used to test a router function with custom exception handler, for example:

 

WebTestClient
    .bindToRouterFunction(myRouter())
    .handlerStrategies(HandlerStrategies.builder()
        .exceptionHandler(new CustomExceptionHandler()) // IS NOT CALLED :(
        .build())
    .build()

 

 

With annotated controllers, the same custom exception is called, for example:

 

WebTestClient
    .bindToController(new MyController())
    .controllerAdvice(new CustomExceptionHandler()) // IS CALLED :)
    .build()

 


Affects: 5.0.8

Reference URL: https://github.com/rodolphocouto/spring-framework-issues/tree/master/SPR-17239

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 12, 2018

Rossen Stoyanchev commented

Looks like several options in HandlerStrategies were added later, but bindToRouterFunction was never updated. This should be fixed now in master for 5.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.