Cleaner error propagation in hystrix javanica #241

Closed
davidkarlsen opened this Issue Apr 12, 2014 · 5 comments

Projects

None yet

6 participants

@davidkarlsen

From:
https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-javanica

"Based on this description, @HystrixCommand has an ability to specify exceptions types which should be ignored and wrapped to throw in HystrixBadRequestException.

@HystrixCommand(ignoreExceptions = {BadRequestException.class})
public User getUserById(String id) {
    return userResource.getUserById(id);
}

If userResource.getUserById(id); throws an exception which type is BadRequestException then this exception will be wrapped in HystrixBadRequestException and will not affect metrics and will not trigger fallback logic."

Wouldn't it be cleaner to unwrap the original exception and rethrow it, like I do in my prototype:
https://github.com/davidkarlsen/hystrix-aop/blob/master/src/main/java/com/davidkarlsen/hystrix/aop/HystrixAspect.java

Because when adding hystrix as an AOP aspect I'd like not to alter the service signature/exceptions thrown. I like the idea that you can tell hystrix which exceptions to ignore as errors, but would like to get them thrown unwrapped, so hystrix is not change how exceptions should be catched by a client. Ideally hystrix should be invisible when throwing "business exceptions".

@dmgcodevil

Hi, good point, thanks. I made PL with fix for this issue.

@bryant-pham

Could you guys update the javanica docs to reflect these changes (re-thrown exceptions are not actually wrapped in HystrixBadRequestException)?

@brazeel

Yes the docs should be updated accordingly 'cuz I was almost fooled..

@mattrjacobs
Netflix, Inc. member

Is this PR clear? #1081

/cc @bryant-pham @brazeel @dmgcodevil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment