我有问题。我使用@ControllerAdvice注释,我无法捕获PSQLException异常。请帮帮我。
@ControllerAdvice
public class GlobalExceptionHandler {
private Logger logger = Logger.getLogger(GlobalExceptionHandler.class);
@ExceptionHandler(PSQLException.class)
@ResponseBody
public Result handlePSQLException(PSQLException ex) {
Result r = new Result();
r.setStatus(Result.ERROR);
logger.error(r.updateMessage("Unable to complete operation"), ex);
return r;
}
}