Skip to content

Commit

Permalink
Add logging to avoid loss of information when exception changes durin…
Browse files Browse the repository at this point in the history
…g retries
  • Loading branch information
joker1007 committed Sep 7, 2023
1 parent ecec67b commit 32e152d
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 32e152d

Please sign in to comment.