This commit is contained in:
parent
82e632660e
commit
257d12d77d
|
|
@ -168,6 +168,8 @@ public class DBException extends AdempiereException
|
|||
* @param e exception
|
||||
*/
|
||||
public static boolean isChildRecordFoundError(Exception e) {
|
||||
if (DB.isPostgreSQL())
|
||||
return isSQLState(e, "23503");
|
||||
return isErrorCode(e, 2292);
|
||||
}
|
||||
|
||||
|
|
@ -186,4 +188,14 @@ public class DBException extends AdempiereException
|
|||
public static boolean isInvalidUserPassError(Exception e) {
|
||||
return isErrorCode(e, 1017);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if "time out" exception (aka ORA-01013)
|
||||
* @param e
|
||||
*/
|
||||
public static boolean isTimeout(Exception e) {
|
||||
if (DB.isPostgreSQL())
|
||||
return isSQLState(e, "57014");
|
||||
return isErrorCode(e, 1013);
|
||||
}
|
||||
} // DBException
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ import java.util.Properties;
|
|||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.exceptions.DBException;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.util.CLogMgt;
|
||||
import org.compiere.util.CLogger;
|
||||
|
|
@ -556,7 +558,10 @@ public class MSequence extends X_AD_Sequence
|
|||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "(Table) [" + trxName + "]", e);
|
||||
next = -2;
|
||||
if (DBException.isTimeout(e))
|
||||
throw new AdempiereException("GenerateDocumentNoTimeOut", e);
|
||||
else
|
||||
throw new AdempiereException("GenerateDocumentNoError", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -838,7 +843,10 @@ public class MSequence extends X_AD_Sequence
|
|||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "(DocType) [" + trxName + "]", e);
|
||||
next = -2;
|
||||
if (DBException.isTimeout(e))
|
||||
throw new AdempiereException("GenerateDocumentNoTimeOut", e);
|
||||
else
|
||||
throw new AdempiereException("GenerateDocumentNoError", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue