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:
Jose Leite 2023-10-11 07:37:31 -03:00 committed by GitHub
parent 756b9e733f
commit 23f464557b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import java.util.Iterator;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.DBException;
import org.compiere.model.I_C_AllocationHdr;
import org.compiere.model.I_C_Cash;
import org.compiere.model.I_C_ProjectIssue;
@ -312,6 +313,11 @@ public abstract class Doc
catch (Throwable t)
{
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();
}
finally