自定义异常

要实现自定义异常需要继承异常处理类 重写需要的方法来完成

 1 package com.booway.d3tilor.sdk.framework.exception;
 2 /**
 3  * 配置异常类
 4  * @author zhouyufei
 5  * 2020年9月4日
 6  */
 7 public class D3tilorConfigException extends RuntimeException
 8 {
 9     private static final long serialVersionUID = 114572850524265810L;
10     
11     private String message = null;
12 
13     public D3tilorConfigException(String message)
14     {
15         super(message);
16     }
17 
18     public D3tilorConfigException(String message, Throwable throwable)
19     {
20         super(message, throwable);
21     }
22 
23     public D3tilorConfigException(Throwable throwable)
24     {
25         super(throwable);
26         this.message = throwable.getMessage();
27     }
28 
29     @Override
30     public String getMessage()
31     {
32         if (null == message)
33         {
34             this.message = super.getMessage();
35         }
36         return message;
37     }
38 
39 }
原文地址:https://www.cnblogs.com/zyfBlogShare/p/13723406.html