wjc
2023-06-28 989b4cf5a84e898e9682f8d9723a8ba1ff20c23b
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.hdl.sdk.link.common.exception;
 
import androidx.annotation.NonNull;
 
/**
 * Created by Tong on 2021/11/11.
 */
public class HDLLinkException extends RuntimeException {
 
    private int code = 0;
    private String msg = "";
    private Throwable rawThrowable;
 
    public HDLLinkException() {
    }
 
    public HDLLinkException(String msg) {
        this.msg = msg;
    }
 
    public HDLLinkException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
 
    public HDLLinkException(int code) {
        this.code = code;
    }
 
    public HDLLinkException(Throwable rawThrowable) {
        this.rawThrowable = rawThrowable;
    }
 
    public int getCode() {
        return code;
    }
 
    public void setCode(int code) {
        this.code = code;
    }
 
    public @NonNull
    String getMsg() {
        return msg;
    }
 
    public void setMsg(String msg) {
        this.msg = msg;
    }
 
    public Throwable getRawThrowable() {
        return rawThrowable;
    }
 
    public void setRawThrowable(Throwable rawThrowable) {
        this.rawThrowable = rawThrowable;
    }
 
    public static HDLLinkException getErrorWithCode(HDLLinkCode code){
        return new HDLLinkException(code.getCode(), code.getMsg());
    }
 
    public static HDLLinkException getErrorWithCode(int code,String msg){
        return new HDLLinkException(code,msg);
    }
}