{
//handle exceptions which occur in a phase-listener (beforePhase) for PhaseId.RENDER_RESPONSE
//needed because #handle gets called too late in this case
if (event instanceof ExceptionQueuedEvent)
{
ExceptionQueuedEvent exceptionQueuedEvent = (ExceptionQueuedEvent)event;
FacesContext facesContext = exceptionQueuedEvent.getContext().getContext();
if (facesContext.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE &&
exceptionQueuedEvent.getContext().inBeforePhase())
{
Throwable exception = getRootCause(exceptionQueuedEvent.getContext().getException());
ExceptionToCatchEvent exceptionToCatchEvent = new ExceptionToCatchEvent(exception);
this.beanManager.fireEvent(exceptionToCatchEvent);
if (exceptionToCatchEvent.isHandled())