[测评系统]--测评系统核心代码库
wzp
2025-08-01 95eb8a2a75cbeebcb3393d404c1952bd59b8989a
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
33
34
35
36
37
38
39
package com.ots.project.common.exception;
import com.ots.common.enums.CodeEnum;
import lombok.Getter;
 
@Getter
public class BaseException extends RuntimeException {
    private static final long serialVersionUID = 2746456762819176173L;
    
    protected CodeEnum responseEnum;
    
    protected Object[] args;
    public BaseException(CodeEnum responseEnum) {
        super(responseEnum.getMessage());
        this.responseEnum = responseEnum;
    }
    public BaseException(int code, String msg) {
        super(msg);
        this.responseEnum = new CodeEnum() {
            @Override
            public int getCode() {
                return code;
            }
            @Override
            public String getMessage() {
                return msg;
            }
        };
    }
    public BaseException(CodeEnum responseEnum, Object[] args, String message) {
        super(message);
        this.responseEnum = responseEnum;
        this.args = args;
    }
    public BaseException(CodeEnum responseEnum, Object[] args, String message, Throwable cause) {
        super(message, cause);
        this.responseEnum = responseEnum;
        this.args = args;
    }
}