/** Set every exception as a global FATAL faces message. */
  @Override
  public void handle() throws FacesException {
    for (Iterator<ExceptionQueuedEvent> iter = getUnhandledExceptionQueuedEvents().iterator();
        iter.hasNext(); ) {
      Messages.create(createFatalMessage(iter.next().getContext().getException())).fatal().add();
      iter.remove();
    }

    wrapped.handle();
  }
  @Override
  public void afterPhase(PhaseEvent event) {
    ExceptionHandler exceptionHandler = event.getFacesContext().getExceptionHandler();
    if (Iterables.isEmpty(exceptionHandler.getUnhandledExceptionQueuedEvents())) {
      return;
    }

    try {
      new OptimisticLockExceptionHandler(exceptionHandler).handle();

      FacesContext faces = FacesContext.getCurrentInstance();
      String nextUrl = ConversationManager.getInstance().getCurrentConversation().nextUrl();

      ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
      String url = externalContext.getRequestContextPath() + nextUrl;
      faces.getExternalContext().redirect(url);
      faces.responseComplete();
    } catch (IOException e) {
      log.error("Failed to redirect to context page in render response phase", e);
    }
  }