Skip to content

Commit

Permalink
fix: Add exception message in callback message (#106)
Browse files Browse the repository at this point in the history
* fix: Add exception message in callback message
  • Loading branch information
izaaz authored Aug 21, 2024
1 parent ce53136 commit cadfa06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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

0 comments on commit cadfa06

Please sign in to comment.