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

fix: Add exception message in callback message #106

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/com/amplitude/HttpTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ public void run() {
callbackMessage = "Unknown response status.";
}
} catch (Exception exception) {
callbackMessage =
"Error sending events due to the exception: " + exception + ". Message: " + exception.getMessage();
logger.error("Flush Thread Error", Utils.getStackTrace(exception));
logger.error("Error event payload", events.toString());
} finally {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/amplitude/HttpTransportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public void testThreadTimeoutCallback()
@Override
public void onLogEventServerResponse(Event event, int status, String message) {
resultMap.put(event, status);
assertEquals("Error send events", message);
assertEquals("Error sending events due to the exception: java.util.concurrent.TimeoutException. Message: null", message);
latch.countDown();
}
};
Expand Down
Loading