puzhibing
2023-10-08 22199bbdda579861736420fe26c2873ab0f5d21c
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
package com.sinata.rest.core.exception;
 
import com.sinata.rest.core.support.StrKit;
 
/**
 * 抽象接口
 *
 * @author fengshuonan
 * @date 2017-12-28-下午10:27
 */
public interface ServiceExceptionEnum {
 
    /**
     * 获取异常编码
     */
    Integer getCode();
 
    /**
     * 获取异常信息
     */
    String getMessage();
 
    /**
     * 工具类初始化异常
     */
    class ToolBoxException extends RuntimeException {
        private static final long serialVersionUID = 8247610319171014183L;
 
        public ToolBoxException(Throwable e) {
            super(e.getMessage(), e);
        }
 
        public ToolBoxException(String message) {
            super(message);
        }
 
        public ToolBoxException(String messageTemplate, Object... params) {
            super(StrKit.format(messageTemplate, params));
        }
 
        public ToolBoxException(String message, Throwable throwable) {
            super(message, throwable);
        }
 
        public ToolBoxException(Throwable throwable, String messageTemplate, Object... params) {
            super(StrKit.format(messageTemplate, params), throwable);
        }
    }
}