自定义异常

/**
* 自定义异常
*/
public class CustomException extends RuntimeException{
private Integer code;
private String message;

CustomException(){}

CustomException(Integer code, String message ){
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}

public String toString(){
return "CustomException{code="+code+",message='"+message+"'}";
}

}
posted @ 2022-01-04 10:53  客至在水一方  阅读(14)  评论(0)    收藏  举报