package com.ycwl.basic.exception;

import com.ycwl.basic.enums.BizCodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author songminsgong
 * @since 2022-11-23
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class AppException extends RuntimeException {

    private Integer code;
    private String msg;

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

    public AppException(BizCodeEnum mobileCodeEnum) {
        super(mobileCodeEnum.getMessage());
        this.code = mobileCodeEnum.getCode();
        this.msg = mobileCodeEnum.getMessage();
    }

    public AppException(BizCodeEnum mobileCodeEnum, String msg) {
        this.code = mobileCodeEnum.getCode();
        this.msg = msg;
    }
}
