我有个问题。我使用了@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;
}
}