public void handle() throws FacesException {
log.trace("Handling Exceptions");
for (Iterator<ExceptionQueuedEvent> it = getUnhandledExceptionQueuedEvents().iterator(); it.hasNext();) {
Throwable t = it.next().getContext().getException();
log.trace(MessageFormat.format("Handling Exception {0}", t.getClass().getName()));
ExceptionToCatch catchEvent = new ExceptionToCatch(t, FacesLiteral.INSTANCE);
try {
if (log.isTraceEnabled()) {
log.trace("Firing event");
}
beanManager.fireEvent(catchEvent);
} catch (Exception e) {
if (!e.equals(t)) {
log.debug("Throwing exception thrown from within Seam Catch");
throw new RuntimeException(e);
}
continue; // exception will be handled by getWrapped().handle() below
}
if (catchEvent.isHandled()) {
log.debug(MessageFormat.format("Exception handled {0}", t.getClass().getName()));
it.remove();
}
}
if (getUnhandledExceptionQueuedEvents().iterator().hasNext()) {