// Path: src/main/java/com/github/marcelothebuilder/webpedidos/service/NegocioException.java
// public class NegocioException extends RuntimeException {
// 	private static final long serialVersionUID = 1L;
// 
// 	public NegocioException() {
// 		super();
// 	}
// 
// 	public NegocioException(String message) {
// 		super(message);
// 	}
// 
// 	public NegocioException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public NegocioException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }


import java.io.IOException;
import java.util.Iterator;
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.application.ViewExpiredException;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerWrapper;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ExceptionQueuedEvent;
import javax.faces.event.ExceptionQueuedEventContext;
import javax.inject.Inject;
import org.apache.commons.logging.Log;
import com.github.marcelothebuilder.webpedidos.service.NegocioException;
package com.github.marcelothebuilder.webpedidos.util.jsf;




public class JsfExceptionHandlerWrapper extends ExceptionHandlerWrapper {
	
	private @Inject Log log;

	private ExceptionHandler wrappedExceptionHandler;

	public JsfExceptionHandlerWrapper(ExceptionHandler exceptionHandler) {
		this.wrappedExceptionHandler = exceptionHandler;
	}

	@Override
	public ExceptionHandler getWrapped() {
		return wrappedExceptionHandler;
	}

	@Override
	public void handle() throws FacesException {
		final Iterator<ExceptionQueuedEvent> exQueuedEventsIterator;

		{
			Iterable<ExceptionQueuedEvent> exQueuedEvents = wrappedExceptionHandler.getUnhandledExceptionQueuedEvents();
			exQueuedEventsIterator = exQueuedEvents.iterator();
		}

		while (exQueuedEventsIterator.hasNext()) {
			ExceptionQueuedEvent queuedEvent = exQueuedEventsIterator.next();
			ExceptionQueuedEventContext context = queuedEvent.getContext();
			Throwable exception = context.getException();

			boolean handled = false;

			try {
// Path: src/main/java/com/github/marcelothebuilder/webpedidos/service/NegocioException.java
// public class NegocioException extends RuntimeException {
// 	private static final long serialVersionUID = 1L;
// 
// 	public NegocioException() {
// 		super();
// 	}
// 
// 	public NegocioException(String message) {
// 		super(message);
// 	}
// 
// 	public NegocioException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public NegocioException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }


// Path: src/main/java/com/github/marcelothebuilder/webpedidos/util/jsf/JsfExceptionHandlerWrapper.java
import java.io.IOException;
import java.util.Iterator;
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.application.ViewExpiredException;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerWrapper;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ExceptionQueuedEvent;
import javax.faces.event.ExceptionQueuedEventContext;
import javax.inject.Inject;
import org.apache.commons.logging.Log;
import com.github.marcelothebuilder.webpedidos.service.NegocioException;

package com.github.marcelothebuilder.webpedidos.util.jsf;




public class JsfExceptionHandlerWrapper extends ExceptionHandlerWrapper {
	
	private @Inject Log log;

	private ExceptionHandler wrappedExceptionHandler;

	public JsfExceptionHandlerWrapper(ExceptionHandler exceptionHandler) {
		this.wrappedExceptionHandler = exceptionHandler;
	}

	@Override
	public ExceptionHandler getWrapped() {
		return wrappedExceptionHandler;
	}

	@Override
	public void handle() throws FacesException {
		final Iterator<ExceptionQueuedEvent> exQueuedEventsIterator;

		{
			Iterable<ExceptionQueuedEvent> exQueuedEvents = wrappedExceptionHandler.getUnhandledExceptionQueuedEvents();
			exQueuedEventsIterator = exQueuedEvents.iterator();
		}

		while (exQueuedEventsIterator.hasNext()) {
			ExceptionQueuedEvent queuedEvent = exQueuedEventsIterator.next();
			ExceptionQueuedEventContext context = queuedEvent.getContext();
			Throwable exception = context.getException();

			boolean handled = false;

			try {
				NegocioException negException = getNegocioExceptionFromStack(exception);