use of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent in project deltaspike by apache.
the class CallingHandlersTest method assertAdditionalParamsAreInjected.
@Test
public void assertAdditionalParamsAreInjected() {
bm.fireEvent(new ExceptionToCatchEvent(new RuntimeException(new IllegalArgumentException())));
assertTrue(calledExceptionHandler.isBeanmanagerInjected());
}
use of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent in project deltaspike by apache.
the class BridgeExceptionHandlerWrapper method handle.
@Override
public void handle() throws FacesException {
FacesContext context = FacesContext.getCurrentInstance();
if (context == null || context.getResponseComplete()) {
return;
}
Iterable<ExceptionQueuedEvent> exceptionQueuedEvents = getUnhandledExceptionQueuedEvents();
if (exceptionQueuedEvents != null && exceptionQueuedEvents.iterator() != null) {
Iterator<ExceptionQueuedEvent> iterator = exceptionQueuedEvents.iterator();
while (iterator.hasNext()) {
Throwable throwable = iterator.next().getContext().getException();
Throwable rootCause = getRootCause(throwable);
if (rootCause instanceof AccessDeniedException) {
processAccessDeniedException(rootCause);
iterator.remove();
continue;
} else {
ExceptionToCatchEvent event = new ExceptionToCatchEvent(rootCause, exceptionQualifier);
event.setOptional(true);
beanManager.fireEvent(event);
if (event.isHandled()) {
iterator.remove();
}
}
// a handle method might redirect and set responseComplete
if (context.getResponseComplete()) {
break;
}
}
}
super.handle();
}
Aggregations