mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-26 15:21:57 +00:00
More detailed exception on persist errors
This commit is contained in:
1 parent
c0375a0b8b
commit
6890ef4334
3 files changed
+18
-2
No files matched your search
@@ -4,6 +4,7 @@ import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.util.StringHelper;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.persist.BeanPersister;
|
||||
import io.ebeaninternal.server.type.DataBindCapture;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
@@ -70,7 +71,7 @@ final class DmlBeanPersister implements BeanPersister {
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
// log the error to the transaction log
|
||||
String msg = "Error[" + StringHelper.removeNewLines(e.getMessage()) + "]";
|
||||
String msg = "Error[" + StringHelper.removeNewLines(e.getMessage()) + "] " + handler;
|
||||
if (request.transaction().isLogSummary()) {
|
||||
request.transaction().logSummary(msg);
|
||||
}
|
||||
|
||||
@@ -259,4 +259,14 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (sql == null) {
|
||||
return "not yet initialized";
|
||||
} else if (bindLog == null || bindLog.length() == 0) {
|
||||
return sql;
|
||||
} else {
|
||||
return Str.add(sql, " -- bind(", bindLog.toString(), ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user