package com.ruoyi.common.exception;

import com.ruoyi.common.enums.ErrorCodes;
import lombok.Getter;

/**
 * 自定义异常
 *
 * @author ruoyi
 */
public class ErrorException extends RuntimeException
{
    private static final long serialVersionUID = 1L;

    @Getter
    private final ErrorCodes errorCode;

    private String message;

    public ErrorException(ErrorCodes errorCode)
    {
        this.errorCode = errorCode;
    }

    public ErrorException(String message, ErrorCodes errorCode)
    {
        this.message = message;
        this.errorCode = errorCode;
    }

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