* Notice to convert
* @return SQLException
*/
public static SQLException makeSQLException(String message, Notice notice) {
PGSQLExceptionInfo e;
String code = notice.getCode();
if (code.startsWith("23")) {
e = new PGSQLIntegrityConstraintViolationException(message + nullToEmpty(notice.getMessage()), notice.getCode());
}
else {
e = new PGSQLSimpleException(message + nullToEmpty(notice.getMessage()), notice.getCode());
}
//Copy extended error information (9.3+)
e.setSchema(notice.getSchema());
e.setTable(notice.getTable());
e.setColumn(notice.getColumn());
e.setDatatype(notice.getDatatype());
e.setConstraint(notice.getConstraint());
return (SQLException) e;
}