protected final void handleException(final Exception e) { final OnFail onFail = getOnFail(); if (OnFail.ThrowException == onFail) { throw AdempiereException.wrapIfNeeded(e); } else if (OnFail.ShowErrorPopup == onFail) { clientUI.error(getParentWindowNo(), e); } else if (OnFail.SilentlyIgnore == onFail) { // Ignore it silently. Don't do logging. // logger.warn("Got error while running: " + runnable + ". Ignored.", e); return; } else if (OnFail.UseHandler == onFail) { final IExceptionHandler exceptionHandler = getExceptionHandler(); if (exceptionHandler == null) { logger.warn( "No exception handler was configurated and OnFail=UseHandler. Throwing the exception"); // fallback throw AdempiereException.wrapIfNeeded(e); } else { exceptionHandler.handleException(e); } } // Fallback: throw the exception else { throw AdempiereException.wrapIfNeeded(e); } }