Skip to content

Commit

Permalink
Merge pull request #325 from joker1007/log-last-exception
Browse files Browse the repository at this point in the history
Add logging to avoid loss of information when exception changes during retries
  • Loading branch information
dmikurube authored Oct 4, 2023
2 parents c2acb83 + 32e152d commit 952cae5
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,18 @@ public void onGiveup(Exception firstException, Exception lastException)
SQLException ex = (SQLException) firstException;
String sqlState = ex.getSQLState();
int errorCode = ex.getErrorCode();
logger.error("{} ({}:{})", errorMessage, errorCode, sqlState);
logger.error("{} (first exception:{SQLState={}, ErrorCode={}})", errorMessage, errorCode, sqlState, ex);
} else {
logger.error("{} (first exception)", errorMessage, firstException);
}

if (lastException instanceof SQLException) {
SQLException ex = (SQLException) lastException;
String sqlState = ex.getSQLState();
int errorCode = ex.getErrorCode();
logger.error("{} (last exception:{SQLState={}, ErrorCode={}})", errorMessage, errorCode, sqlState, ex);
} else {
logger.error("{} (last exception)", errorMessage, lastException);
}
}

Expand Down

0 comments on commit 952cae5

Please sign in to comment.