-
Notifications
You must be signed in to change notification settings - Fork 48
Handle void response in injectCredentialsAndInvoke #338
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
import java.util.Objects; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.BiFunction; | ||
import java.util.function.Consumer; | ||
import java.util.function.Function; | ||
import java.util.function.Supplier; | ||
import javax.annotation.Nonnull; | ||
|
@@ -443,9 +444,24 @@ public ProgressEvent<ModelT, CallbackT> done(Function<ResponseT, ProgressEvent<M | |
request.setRequestCredentialsProvider(v1CredentialsProvider); | ||
|
||
try { | ||
ResultT respose = requestFunction.apply(request); | ||
logRequestMetadata(request, respose); | ||
return respose; | ||
ResultT response = requestFunction.apply(request); | ||
logRequestMetadata(request, response); | ||
return response; | ||
} catch (final Throwable e) { | ||
loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage())); | ||
throw e; | ||
omkhegde marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} finally { | ||
request.setRequestCredentialsProvider(null); | ||
} | ||
} | ||
|
||
public <RequestT extends AmazonWebServiceRequest> void injectCredentialsAndInvoke(final RequestT request, | ||
final Consumer<RequestT> requestFunction) { | ||
johnttompkins marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should also just make a void function for the v2 proxy as well? if we are tackling the v1 here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think v2 functions are required to return a result and are never void. @ammokhov can you please confirm? |
||
|
||
request.setRequestCredentialsProvider(v1CredentialsProvider); | ||
|
||
try { | ||
requestFunction.accept(request); | ||
} catch (final Throwable e) { | ||
loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage())); | ||
throw e; | ||
|
Uh oh!
There was an error while loading. Please reload this page.