improve SQL exceptions to be more easily debuggable

This commit is contained in:
nossr50 2024-01-15 10:21:30 -08:00
parent 009d809d76
commit dda5b45bb1

View File

@ -129,7 +129,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
loadPool = new DataSource(poolProperties); loadPool = new DataSource(poolProperties);
checkStructure(); checkStructure();
} }
@NotNull @NotNull
@ -1272,13 +1271,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
private void printErrors(SQLException ex) { private void printErrors(SQLException ex) {
if (debug || h2) { ex.printStackTrace();
ex.printStackTrace();
} else {
for (StackTraceElement element : ex.getStackTrace()) {
logger.severe("Location: " + element.getClassName() + " " + element.getMethodName() + " " + element.getLineNumber());
}
}
// logger.severe("SQLException: " + ex.getMessage()); // logger.severe("SQLException: " + ex.getMessage());
logger.severe("SQLState: " + ex.getSQLState()); logger.severe("SQLState: " + ex.getSQLState());