leesam
2024-03-19 76208975bffec39eb62f8599a68d583a5cb6da18
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
package com.genersoft.iot.vmp.conf.exception;
 
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 
/**
 * 自定义异常,controller出现错误时直接抛出异常由全局异常捕获并返回结果
 */
public class ControllerException extends RuntimeException{
 
    private int code;
    private String msg;
 
    public ControllerException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }
 
    public int getCode() {
        return code;
    }
 
    public void setCode(int code) {
        this.code = code;
    }
 
    public String getMsg() {
        return msg;
    }
 
    public void setMsg(String msg) {
        this.msg = msg;
    }
}