package com.jscape.util.fsm;

/**
 * @author Alex Usun
 */
public class FSMException
        extends Exception {

    private static final long serialVersionUID = -1115415224252421303L;

    public static FSMException wrap(Throwable e) {
        return e instanceof FSMException ? (FSMException) e : e.getMessage() != null ? new FSMException(e.getMessage(), e) : new FSMException(e);
    }

    public FSMException() {
    }

    public FSMException(String message) {
        super(message);
    }

    public FSMException(String message, Throwable cause) {
        super(message, cause);
    }

    public FSMException(Throwable cause) {
        super(cause.getMessage() != null ? cause.getMessage() : cause.toString(), cause);
    }
}
