异常捕获类用 RuntimeException 前台可以获取错误json,但是用自定义的AreaException前台是错误页面,后台也会报错
@ExceptionHandler(value = RuntimeException.class) 正确 @ExceptionHandler(value = AreaException.class) 错误
自定义异常类如下
package com.imooc.demo.exception;
public class AreaException extends RuntimeException {
public AreaException(String message) {
super(message);
}
public AreaException(String message, Throwable cause) {
super(message, cause);
}
}不知道哪块的问题,求大神解答