package com.xt.hb.data.core;

import java.util.concurrent.TimeUnit;

public class TaskRedoException extends RuntimeException {
    /** serialVersionUID */
    private static final long serialVersionUID = 2836734247983629232L;
    /** the time from now to delay execution */
    private long delay;
    /** the time unit of the delay parameter */
    private TimeUnit unit;
    /** 详细信息 */
    private String msg;

    public String getMsg() {
        return msg;
    }

    @Override
    public String getMessage() {
        if (msg != null && msg.length() > 0) { return msg; }
        return super.getMessage();
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public long getDelay() {
        return delay;
    }

    public TimeUnit getUnit() {
        return unit;
    }

    public TaskRedoException() {
        super();
    }

    public TaskRedoException(long delay, TimeUnit unit) {
        this.delay = delay;
        this.unit = unit;
    }

    public TaskRedoException(long delay, TimeUnit unit, Throwable e) {
        super(e);
        this.delay = delay;
        this.unit = unit;
    }

    public TaskRedoException(long delay, TimeUnit unit, String msg) {
        this.delay = delay;
        this.unit = unit;
        this.msg = msg;
    }
}
