import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;
/**
* 通用异常
*
* @author tt
* @date 2020/4/8 15:54
*/
@Getter
@Setter
public class CommonException extends RuntimeException {
private Integer code;
private String msg;
public CommonException() {
super("服务器异常");
this.code = 500;
this.msg = "服务器异常";
}
public CommonException(String msg, Object... arguments) {
super(StrUtil.format(msg, arguments));
this.code = 500;
this.msg = StrUtil.format(msg, arguments);
}
public CommonException(Integer code, String msg, Object... arguments) {
super(StrUtil.format(msg, arguments));
this.code = code;
this.msg = StrUtil.format(msg, arguments);
}
}
java 通用自定义异常
最新推荐文章于 2025-11-26 15:59:01 发布
497

被折叠的 条评论
为什么被折叠?



