package com.loan.system.exception;

import com.loan.system.domain.enums.ExceptionEnum;

/**
 * @author EdwinXu
 * @date 2020/9/2 - 20:28
 */
public class DescribeException extends RuntimeException {
    private static final long serialVersionUID = 1721399907506190029L;
    private Integer code;

    public DescribeException(Integer code ,String msg) {
        super(msg);
        this.code = code;
    }

    public DescribeException(ExceptionEnum exceptionEnum){
        super(exceptionEnum.getMsg());
        this.code = exceptionEnum.getCode();
    }

    Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return "DescribeException { " +"code = " + code + " msg = " + this.getMessage() +" }";
    }
}
