package com.yn.bftl.thirdparty.common.exception;

import com.yn.bftl.common.common.exception.YnceErrorCode;

import java.io.Serializable;

/**
 * @author huabiao
 * @create 2021/4/23  10:02
 */
public class YnceErrorException extends RuntimeException implements Serializable {
    private static final long serialVersionUID = 1L;

    public YnceErrorException(YnceErrorCode ynceErrorCode) {
        super(ynceErrorCode.getStatus() + "#" + ynceErrorCode.getMsg());
    }

    public YnceErrorException(YnceErrorCode ynceErrorCode, String additionalString) {
        super(ynceErrorCode.getStatus() + "#" + ynceErrorCode.getMsg() + ":" + additionalString);
    }

    public YnceErrorException(String code, String message) {
        super(code + "#" + message);
    }

    public YnceErrorException(String message) {
        super(500 + "#" + message);
    }

    // 重写此方法返回this,业务异常不打印堆栈信息提高速度
    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }
}