pull/7/head
lkw2731938298 1 month ago
parent 2930c302fd
commit f6894d3885

@ -1,13 +1,23 @@
package com.shanzhu.market.common.exception; package com.shanzhu.market.common.exception;
// 声明当前类所在的包路径(异常处理模块的基础包)
import com.shanzhu.market.common.constants.HttpStatus; import com.shanzhu.market.common.constants.HttpStatus;
// 导入包含HTTP状态码常量的工具类
public class BusinessException extends SysException { public class BusinessException extends SysException {
// 定义业务异常类继承自系统基础异常类SysException
public BusinessException(String message, Integer code) { public BusinessException(String message, Integer code) {
// 全参数构造方法(接收自定义错误消息和数字状态码)
super(message, code); super(message, code);
// 调用父类构造器初始化异常基类属性
} }
public BusinessException(String msg) { public BusinessException(String msg) {
// 简化构造方法(仅接收错误消息参数)
super(msg, HttpStatus.CODE_BUSINESS_ERROR); super(msg, HttpStatus.CODE_BUSINESS_ERROR);
// 调用父类构造器,使用预定义的业务异常状态码常量
} }
} }

Loading…
Cancel
Save