package com.xly.erp.common.exception; import lombok.Getter; /** * 业务异常 — 由 service 层抛出,由 GlobalExceptionHandler 统一转 Result.fail。 * docs/04 § 1.4。 */ @Getter public class BizException extends RuntimeException { private final int code; /** 可选附带的响应数据(例如 42301 锁定返 lockUntil)。null 表示无 data 字段。 */ private final Object data; public BizException(int code, String message) { this(code, message, (Object) null); } public BizException(int code, String message, Object data) { super(message); this.code = code; this.data = data; } public BizException(int code, String message, Throwable cause) { super(message, cause); this.code = code; this.data = null; } }