继承runtimeexception可以不处理异常:
package com.example.emos.wx.exception; import lombok.Data; @Data public class EmosException extends RuntimeException{ private String msg; private int code = 500; public EmosException(String msg) { super(msg); this.msg = msg; } public EmosException(String msg, Throwable e) { super(msg, e); this.msg = msg; } public EmosException(String msg, int code) { super(msg); this.msg = msg; this.code = code; } public EmosException(String msg, int code, Throwable e) { super(msg, e); this.msg = msg; this.code = code; } }
标签:code,String,自定义,super,EmosException,msg,异常,public From: https://www.cnblogs.com/sgj191024/p/17743990.html