[#4391] Example exception translator should only translate SQLException

This commit is contained in:
lukaseder 2015-06-16 16:08:16 +02:00
parent c270e6281a
commit 783dc5461a

View File

@ -69,11 +69,15 @@ public class ExceptionTranslator extends DefaultExecuteListener {
@Override
public void exception(ExecuteContext ctx) {
SQLDialect dialect = ctx.configuration().dialect();
SQLExceptionTranslator translator = (dialect != null)
? new SQLErrorCodeSQLExceptionTranslator(dialect.name())
: new SQLStateSQLExceptionTranslator();
// [#4391] Translate only SQLExceptions
if (ctx.sqlException() != null) {
SQLDialect dialect = ctx.configuration().dialect();
SQLExceptionTranslator translator = (dialect != null)
? new SQLErrorCodeSQLExceptionTranslator(dialect.name())
: new SQLStateSQLExceptionTranslator();
ctx.exception(translator.translate("jOOQ", ctx.sql(), ctx.sqlException()));
ctx.exception(translator.translate("jOOQ", ctx.sql(), ctx.sqlException()));
}
}
}