package com.psbc.cpsp.entity;

import com.psbc.cpsp.entity.enums.BaseRespCodeInterFace;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 主动抛出异常
 */
@Data
@NoArgsConstructor
public class BizException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private String code;
    private String message;


    public BizException(BaseRespCodeInterFace respCode) {
        super(respCode.getDesc());
        this.code = respCode.getCode();
        this.message = respCode.getDesc();
    }


    public BizException(BaseRespCodeInterFace respCode, String message) {
        super(message);
        this.code = respCode.getCode();
        this.message = message;
    }
    public BizException(String errorCode, String errorMessage) {
        super(errorCode + ":" + errorMessage);
        this.code = errorCode;
        this.message = errorMessage;
    }
}
