You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- package com.xkcoding.common.exception;
-
- import com.xkcoding.common.enums.CommonStatus;
- import com.xkcoding.common.enums.base.IStatus;
- import lombok.Data;
- import lombok.EqualsAndHashCode;
-
- /**
- * 通用业务异常
- *
- * @author yangkai.shen
- * @date 2022-08-20 01:55
- */
- @Data
- @EqualsAndHashCode(callSuper = true)
- public class CommonBizException extends RuntimeException {
- public Integer code;
- private String message;
-
- public CommonBizException(Integer code, String message) {
- super(message);
- this.code = code;
- this.message = message;
- }
-
- public CommonBizException(Throwable cause) {
- super(cause);
- this.code = CommonStatus.SERVER_ERROR.getCode();
- this.message = cause.getMessage();
- }
-
- public CommonBizException(String message) {
- super(message);
- this.code = CommonStatus.SERVER_ERROR.getCode();
- this.message = message;
- }
-
- public CommonBizException(IStatus status) {
- super(status.getDesc());
- this.code = status.getCode();
- this.message = status.getDesc();
- }
- }
|