自定义异常与错误码
1.自定义异常
public class SystemException extends Exception {
private static final long serialVersionUID = 1L;
private Object[] args;
private Code code;
public SystemException(Code code) {
super(CodeUtil.getMessage(code));
this.code = code;
}
public SystemException(Code code, String args) {
super(CodeUtil.getMessage(code, args));
this.code = code;
this.args = new String[]{
args};
}
public SystemException(Code code, String args, Throwable cause) {
super(CodeUtil.getMessage(code, args), cause);
this.code = code;
this.args = new String[]{
args};
}
public SystemException(Code code, String[] args) {
super(CodeUtil.getMessage(code, args));
this.code = code;
th