/*
 * Created on 2004-1-22
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package workflow;
/**
 * @author reic
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class WorkflowException extends Exception
{ 
	private Throwable rootCause;

	/**
	 * Constructs a new workflow exception.
	 */
	public WorkflowException()
	{
    super();
	}
   
	/**
	 * Constructs a new workflow exception with the
	 * specified message. The message can be written 
	 * to the server log and/or displayed for the user. 
	 *
	 * @param message    a <code>String</code> 
	 *       specifying the text of 
	 *       the exception message
	 *
	 */
	public WorkflowException(String message)
	{
		super(message);
	}
	/**
	 * Constructs a new workflow exception when the workflow 
	 * needs to throw an exception and include a message 
	 * about the "root cause" exception that interfered with its 
	 * normal operation, including a description message.
	 *
	 *
	 * @param message    a <code>String</code> containing 
	 *       the text of the exception message
	 *
	 * @param rootCause    the <code>Throwable</code> exception 
	 *       that interfered with the workflow's
	 *       normal operation, making this workflow
	 *       exception necessary
	 *
	 */
	public WorkflowException(String message, Throwable rootCause)
	{
		super(message);
		this.rootCause = rootCause;
	}
	/**
	 * Constructs a new workflow exception when the workflow 
	 * needs to throw an exception and include a message
	 * about the "root cause" exception that interfered with its
	 * normal operation.  The exception's message is based on the localized
	 * message of the underlying exception.
	 *
	 * <p>This method calls the <code>getLocalizedMessage</code> method
	 * on the <code>Throwable</code> exception to get a localized exception
	 * message. When subclassing <code>ServletException</code>, 
	 * this method can be overridden to create an exception message 
	 * designed for a specific locale.
	 *
	 * @param rootCause  the <code>Throwable</code> exception
	 *         that interfered with the workflow's
	 *       normal operation, making the workflow exception
	 *       necessary
	 *
	 */
	public WorkflowException(Throwable rootCause)
	{
		super(rootCause.getLocalizedMessage());
		this.rootCause = rootCause;
	}
	/**
	 * Returns the exception that caused this workflow exception.
	 *
	 *
	 * @return     the <code>Throwable</code> 
	 *       that caused this workflow exception
	 *
	 */
	public Throwable getRootCause()
	{
		return rootCause;
	}
}
