package com.huashe.common.exception;

/**
 * 业务异常
 *
 * @author ruoyi
 */
public class BusinessException extends RuntimeException {
    /**
     * 错误码
     */
    protected int code;

    protected final String message;

    /**
     * 扩展属性
     */
    private Object ext;

    public BusinessException(String message) {
        this.message = message;
    }

    public BusinessException(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public BusinessException(String message, Throwable e) {
        super(message, e);
        this.message = message;
    }

    public BusinessException(int code, String message, Throwable e) {
        super(message, e);
        this.code = code;
        this.message = message;
    }

    public BusinessException(int code, String message, Object ext) {
        this.code = code;
        this.message = message;
        this.ext = ext;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public int getCode() {
        return code;
    }

    public Object getExt() {
        return ext;
    }
}
