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

FallbackHandler's ExecutionContext should provide Exception getter #224

Closed
derekm opened this issue Feb 3, 2018 · 5 comments
Closed

FallbackHandler's ExecutionContext should provide Exception getter #224

derekm opened this issue Feb 3, 2018 · 5 comments
Assignees
Milestone

Comments

@derekm
Copy link

derekm commented Feb 3, 2018

FallbackHandler's ExecutionContext should provide access to the exception that was caught, for example, here: https://github.com/eclipse/microprofile-fault-tolerance/blob/master/api/src/main/java/org/eclipse/microprofile/faulttolerance/Retry.java#L103

@derekm derekm changed the title FallbackHandler's FallbackHandler's ExecutionContext should provide Exception getter Feb 3, 2018
@Emily-Jiang
Copy link
Member

Can you explain the use case?

@antoinesd
Copy link
Contributor

Understand the possible use cases here (intelligent fallback according exception type). But wouldn't be too overkill ?

@derekm
Copy link
Author

derekm commented Feb 8, 2018

We kind of want to notify our callers that a fault occurred, by throwing an exception from the fallback method that the caller can catch for fault details. In order to notify callers of exceptional events, we need our fallback to know about these exceptional events.

We also had ideas about fallbacks that didn't notify their callers but that handled different errors more intelligently. Of course, this could be handled in another way by methods-under-fault doing work before throwing exceptions that trigger MicroProfile Fault Tolerance, but that's actually overkill also (burdening the user-programmer with disparate error-handling logic rather than unifying the error handling logic into the fallback).

We are finding other approaches since both of these ideas are infeasible right now.

@Emily-Jiang
Copy link
Member

Emily-Jiang commented Feb 14, 2018

After further discussion in today's hangout, we think it is useful to add a getter in the ExecutionContext interface.

@Emily-Jiang Emily-Jiang added this to the 1.1 milestone Feb 14, 2018
@derekm
Copy link
Author

derekm commented Feb 14, 2018

Great! Thanks! This will be helpful in the future!

FWIW, for our main situation, we moved our operation that needs Fault Tolerance into an ObserveAsync listener, and we assume the process has failed until it succeeds (that is, we write out "not succeeded" before fireAsync() until a success writes out "succeeded", instead of our fallback handler writing out "failed" when it has failed).

@Emily-Jiang Emily-Jiang self-assigned this Mar 6, 2018
Emily-Jiang added a commit that referenced this issue Mar 7, 2018
Signed-off-by: Emily Jiang <emijiang@uk.ibm.com>
Emily-Jiang added a commit that referenced this issue Mar 7, 2018
#224 support the exception retrival
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants