IDEMPIERE-5872 - Improve on SQL Errors displayed for user (#2033)
* IDEMPIERE-5872 - Improve on SQL Errors displayed for user * IDEMPIERE-5872 - Improve on SQL Errors displayed for user
This commit is contained in:
parent
756b9e733f
commit
23f464557b
|
@ -30,6 +30,7 @@ import java.util.Iterator;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.exceptions.DBException;
|
||||||
import org.compiere.model.I_C_AllocationHdr;
|
import org.compiere.model.I_C_AllocationHdr;
|
||||||
import org.compiere.model.I_C_Cash;
|
import org.compiere.model.I_C_Cash;
|
||||||
import org.compiere.model.I_C_ProjectIssue;
|
import org.compiere.model.I_C_ProjectIssue;
|
||||||
|
@ -312,6 +313,11 @@ public abstract class Doc
|
||||||
catch (Throwable t)
|
catch (Throwable t)
|
||||||
{
|
{
|
||||||
trx.rollback();
|
trx.rollback();
|
||||||
|
if(t instanceof SQLException sqlEx) {
|
||||||
|
String messageError = DBException.getDefaultDBExceptionMessage(sqlEx);
|
||||||
|
if (messageError != null)
|
||||||
|
return Msg.getMsg(Env.getCtx(), messageError);
|
||||||
|
}
|
||||||
return "@Error@ " + t.getLocalizedMessage();
|
return "@Error@ " + t.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
Loading…
Reference in New Issue