package com.jeequan.jeepay.core.exception;

import lombok.Getter;
import lombok.experimental.Accessors;

/**
 * 数据校验异常
 *
 * @author deng
 * @since 2024/5/17
 */
@Getter
@Accessors(chain = true, fluent = true)
public class DataCheckException extends RuntimeException{

    private static final long serialVersionUID = 1L;

    /**
     * 校验前若发生过数据保存或变更，则需要回滚
     */
    private final boolean needRollback;

    /** 数据校验异常 **/
    public DataCheckException(String msg, boolean needRollback) {
        super(msg);
        this.needRollback = needRollback;
    }

    /** 数据校验异常 **/
    public DataCheckException(String msg) {
        this(msg, false);
    }
}
