spring-retry icon indicating copy to clipboard operation
spring-retry copied to clipboard

Rework Exception-wrapping

Open jbspeakr opened this issue 7 years ago • 2 comments

Currently, @CircuitBreaker always wraps failures into into an ExhaustedRetryException. This hides the true nature of the failure and makes it furthermore impossible to figure out whether the circuit breaker is actually open or not.

Having e.g. a @Recover-method just to unwrap and rethrow exceptions seems not a proper way to go... it also doesn't solve the circuit breaker status issue.

The only currently available alternative is to implement a custom circuit breaker RetryTemplate which feels odd.

Please fix.

jbspeakr avatar Jun 27 '17 11:06 jbspeakr

It's not really a @CircuitBreaker feature is it (the RetryTemplate always wraps the last failed exception)? It has been like that since the beginning, and therefore there might be reasons and also people relying on the behaviour, so "please fix" is kind of irresponsible. If you have a concrete suggestion about how to evolve the code please feel free to comment or send patches.

dsyer avatar Dec 12 '17 09:12 dsyer

@dsyer Hi, dsyer About the issue, I make a pull request #133 . I add an option on the @Retryable to decide whether the original exception will be thrown . Please review, thanks!

getupdown avatar Nov 06 '18 17:11 getupdown