spring-cloud-netflix: Zuul filters exception handling
Current implementation of exception handling in spring-cloud-zuul is quite ambigious. I tried to simplify it a little bit in my PR. Now I want to handle specific exceptions and return appropriate responses for them. Normally in any spring application I would create separate class annotated with ControllerAdvice and having methods with @ExceptionHandler for specific exception types. In spring-cloud-zuul exceptions get handled by BasicErrorController and none of ExceptionHandler annotated methods get executed. Is it a bug or an intenteded decision and what are the reasons?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 14
- Comments: 17 (11 by maintainers)
Understood. Thanks for the update.
For example if timeout occurs while routing to service client gets following response from Zuul:
This is default message that is produced by
BasicErrorController. But I want to not only have my own message format in case of such or otherZuulExceptionI would also like to handle exceptions the way it is done in standart spring applications via@ExceptionHandler. Right now to achieve this I need to extendAbstractErrorControllerand the basic implementation of custom exception handling looks like that:Please advice how exception handling in Zuul can be done the right way. Thanks.
@stiyyagura Would you mind explaining what did you end up doing, so if someone stumbles upon this thread later, they’ll have something to go on.