-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 option to raise HystrixRuntimeException #1397
Add option to raise HystrixRuntimeException #1397
Conversation
Thanks for the contribution @michaelcowan ! It looks like you've used some Java8 classes in this PR. Can you refactor to target JDK6? We're still targeting that JDK until we get to Hystrix 2. |
@mattrjacobs I've looked through the PR and can't see any Java 8 classes 😕 I was careful to only repeat existing patterns and used JDK1.6 when building locally. |
Apologies - I must have done something incorrectly when I ran this locally. Build passes for me, and visual inspection looks good too. Thanks for the contribution! |
So I'm just now discovering this and thought I would add my 2 cents. While this is a step in the right direction it does not completely solve the issue. Think about a developer who is using the MVC pattern - the service facade layer of the application is where all of this hystrix "stuff" comes into play. The API of that layer is the contract between this layer & the layer above it (for a web application - some controller/restful API layer). This addition makes the caller of the service facade layer have to know specific details that Hystrix is involved by having to catch HystrixRuntimeException, look for a fallback exception (which is generally a FallbackInvocationException) and then have to read the cause from that. Why can't we simply throw whatever exception is thrown from the fallback? I have a post on StackOverflow which describes the scenario I'm trying to handle. http://stackoverflow.com/questions/40495259/capture-exception-thrown-by-hystrix-fallback |
Actually I was able to solve my use case using this approach. I posted my solution back on my stackoverflow post: http://stackoverflow.com/questions/40495259/capture-exception-thrown-by-hystrix-fallback/40529532#40529532 |
Actually it seems that this only works while the circuit is closed. Once the circuit is tripped open the HystrixRuntimeException gets propagated back up.
|
@edeandrea answered here: http://stackoverflow.com/a/40551009/1325109 |
Adds the option to allow HystrixRuntimeException to be thrown by
HystrixCommandAspect
.The new property raiseHystrixExceptions is supported by both
DefaultProperties
andHystrixCommand
.e.g.
This pattern is extensible should people wish to add support for other Hystrix exceptions.
PR requested by @dmgcodevil