package com.qiaoba.common.base.exception;


import lombok.Getter;
import lombok.Setter;

/**
 * 自定义 业务异常
 *
 * @author ailanyin
 * @version 1.0
 * @since 2021-08-31
 */
@Getter
@Setter
public class ServiceException extends RuntimeException {

    /**
     * 错误码
     */
    private Integer errorCode;

    /**
     * 错误信息
     */
    private String message;

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

    public ServiceException(Integer code, String message) {
        this.message = message;
        this.errorCode = code;
    }

    /**
     * 控制台不打印自定义错误的堆栈信息, 提高性能
     *
     * @return this
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

}
