Skip to content

Commit

Permalink
feat: add lambda response payload to exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
its-felix committed Sep 5, 2024
1 parent d16a7ac commit f7a81d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.gw2auth</groupId>
<artifactId>oauth2-server</artifactId>
<version>1.83.0</version>
<version>1.84.0</version>
<packaging>jar</packaging>

<parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ private ResponseEntity<Resource> get(InvokeRequest invokeRequest) throws Excepti
final InvokeResponse lambdaResponse = this.lambda.invoke(invokeRequest);

if (lambdaResponse.functionError() != null) {
throw new RuntimeException(lambdaResponse.functionError());
final String payload;
try (InputStream in = lambdaResponse.payload().asInputStream()) {
payload = new String(in.readAllBytes(), StandardCharsets.UTF_8);
}

throw new RuntimeException(lambdaResponse.functionError() + ": " + payload);
}

final int statusCode;
Expand Down

0 comments on commit f7a81d7

Please sign in to comment.