Blame view

src/main/java/cn/iocoder/dashboard/common/exception/ServiceException.java 1.2 KB
0a607861   YunaiV   common 包,基础组件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  package cn.iocoder.dashboard.common.exception;
  
  import cn.iocoder.dashboard.common.exception.enums.ServiceErrorCodeRange;
  import lombok.Data;
  import lombok.EqualsAndHashCode;
  
  /**
   * 业务逻辑异常 Exception
   */
  @Data
  @EqualsAndHashCode(callSuper = true)
  public final class ServiceException extends RuntimeException {
  
      /**
       * 业务错误码
       *
       * @see ServiceErrorCodeRange
       */
      private Integer code;
      /**
       * 错误提示
       */
      private String message;
  
      /**
       * 空构造方法,避免反序列化问题
       */
      public ServiceException() {
      }
  
      public ServiceException(ErrorCode errorCode) {
          this.code = errorCode.getCode();
5a1491d7   YunaiV   短信提交 2021-04-01,重...
33
          this.message = errorCode.getMsg();
0a607861   YunaiV   common 包,基础组件
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
      }
  
      public ServiceException(Integer code, String message) {
          this.code = code;
          this.message = message;
      }
  
      public Integer getCode() {
          return code;
      }
  
      public ServiceException setCode(Integer code) {
          this.code = code;
          return this;
      }
  
4ab1cf1c   YunaiV   1. 完成用户导入的功能
50
      @Override
0a607861   YunaiV   common 包,基础组件
51
52
53
54
55
56
57
58
59
60
      public String getMessage() {
          return message;
      }
  
      public ServiceException setMessage(String message) {
          this.message = message;
          return this;
      }
  
  }