-
Notifications
You must be signed in to change notification settings - Fork 883
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
Translate S3Exception for headObject and headBucket #830
Conversation
try { | ||
Context.FailedExecution failedContext = | ||
new DefaultFailedExecutionContext(context.executionContext().interceptorContext(), failure); | ||
context.interceptorChain().onExecutionFailure(failedContext, context.executionAttributes()); | ||
} catch (SdkServiceException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we go all-out and propagate SdkException
? All of the exceptions? Do we have similar behavior for the other on* methods, that suppresses exceptions that are thrown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The swallowing behavior is only onExecuteFailure
since at this point there's already an Exception
thrown higher up. The other on*
methods let the exception propagate
Lines 142 to 160 in fee061b
@Test | |
public void test() { | |
if (hook != Hook.ON_EXECUTION_FAILURE) { | |
doVerify(() -> clientHandler.execute(executionParams), (t) -> t.getCause().getCause().getMessage().equals(hook.name())); | |
} else { | |
// ON_EXECUTION_FAILURE is handled differently because we don't | |
// want an exception thrown from the interceptor to replace the | |
// original exception. | |
doVerify(() -> clientHandler.execute(executionParams), | |
(t) -> { | |
for (; t != null; t = t.getCause()) { | |
if (Hook.ON_EXECUTION_FAILURE.name().equals(t.getMessage())) { | |
return false; | |
} | |
} | |
return true; | |
}); | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with propagating SdkException
. @shorea Do you have any concerns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add another interceptor method that lets you modify the exception so you don't have to throw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Andrew coming in with the BIG ideas. I like it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added modifyException
interceptor method.
|
||
/** | ||
* Translate S3Exception for the API calls that do not contain the detailed error code. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long-term, should we push these upstream to s3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we should.
3f78b16
to
d26f697
Compare
859a8a7
to
aba3121
Compare
Add modifyException interceptor
aba3121
to
588bca7
Compare
Translate S3Exception for headObject and headBucket via interceptor
Throw
NoSuchKey
exception for headObject andNoSuchBucket
exception for headBucket for 404 status code.Added
modifyException
interceptor methodAll S3 integration tests passed