We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b28e647 commit c255af3Copy full SHA for c255af3
1 file changed
src/main/java/info/cadecode/simple/common/exception/SimpleException.java
@@ -0,0 +1,35 @@
1
+package info.cadecode.simple.common.exception;
2
+
3
+import info.cadecode.simple.constant.ReasonEnum;
4
5
+/**
6
+ * @author Cade Li
7
+ * @date 2021/7/16
8
+ * @description: 自定义异常类总类
9
+ */
10
+public class SimpleException extends RuntimeException {
11
12
13
+ private final Integer code;
14
+ private final String msg;
15
16
17
+ public SimpleException(Integer code, String msg) {
18
+ this.code = code;
19
+ this.msg = msg;
20
+ }
21
22
23
+ public SimpleException(ReasonEnum reasonEnum) {
24
+ this.code = reasonEnum.getCode();
25
+ this.msg = reasonEnum.getMsg();
26
27
28
+ public Integer getCode() {
29
+ return code;
30
31
32
+ public String getMsg() {
33
+ return msg;
34
35
+}
0 commit comments