SpringBoot自定义异常和自定义返回格式(例如token)便于前端接收抛出
有的时候对于一些特殊的异常,我们需要进行别人的处理,那怎么自定义我们的异常的?
//这里可继承你需要定义的错误
public class CustomException extends RuntimeException {
//可以用来接受我们方法中传的参数
private String code;
private String msg;
public CustomException(String code,String msg) {
//super("T
原创
2020-07-18 10:53:03 ·
1200 阅读 ·
0 评论