Skip to content

Commit

Permalink
Fix an issue that exception messages are masked (#4416)
Browse files Browse the repository at this point in the history
* Show exception stacktrace

Signed-off-by: Hai Yan <[email protected]>

* Tweak log messages

Signed-off-by: Hai Yan <[email protected]>

---------

Signed-off-by: Hai Yan <[email protected]>
  • Loading branch information
oeyh authored May 13, 2024
1 parent 1c7e881 commit 2653acd
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ private void doWrite(final List<DlqObject> dlqObjects, final String pipelineName
final PutObjectResponse response = timedPutObject(putObjectRequest, content);

if (!response.sdkHttpResponse().isSuccessful()) {
LOG.error(SENSITIVE, "Failed to write to S3 dlq: [{}] to S3 due to status code: [{}]",
content, response.sdkHttpResponse().statusCode());
LOG.error(SENSITIVE, "Failed to write content [{}] to S3 dlq", content);
LOG.error("Failed to write to S3 dlq due to status code: [{}]", response.sdkHttpResponse().statusCode());
throw new IOException(String.format(
"Failed to write to S3 dlq due to status code: %d", response.sdkHttpResponse().statusCode()));
}
Expand All @@ -123,8 +123,7 @@ private PutObjectResponse timedPutObject(final PutObjectRequest putObjectRequest
} catch (final IOException ioException) {
throw ioException;
} catch (final Exception ex) {
LOG.error(SENSITIVE, "Failed timed write to S3 dlq: [{}] to S3 due to error: [{}]",
content, ex.getMessage());
LOG.error(SENSITIVE, "Failed timed write to S3 dlq with content: [{}]", content, ex);
throw new IOException("Failed timed write to S3 dlq.", ex);
}
}
Expand All @@ -133,8 +132,7 @@ private PutObjectResponse putObject(final PutObjectRequest request, final String
try {
return s3Client.putObject(request, RequestBody.fromString(content));
} catch (Exception ex) {
LOG.error(SENSITIVE, "Failed to write to S3 dlq: [{}] to S3 due to error: [{}]",
content, ex.getMessage());
LOG.error(SENSITIVE, "Failed to write content [{}] to S3 dlq", content, ex);
throw new IOException("Failed to write to S3 dlq.", ex);
}
}
Expand All @@ -149,8 +147,7 @@ private String deserialize(final List<DlqObject> dlqObjects) throws IOException

return content;
} catch (JsonProcessingException e) {
LOG.error(SENSITIVE, "Failed to build valid S3 request body with dlqObjects: [{}] due to error: [{}]",
dlqObjects, e.getMessage());
LOG.error(SENSITIVE, "Failed to build valid S3 request body with dlqObjects: [{}]", dlqObjects, e);
throw new IOException("Failed to build valid S3 request body", e);
}
}
Expand Down

0 comments on commit 2653acd

Please sign in to comment.