0

私は問題があります。@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;
    }
}
4

1 に答える 1