StreamingResponseBody 中的异常处理不起作用

Asw*_*gan 8 java spring outputstream

我试图捕获在我的实现中抛出的异常StreamingResponseBody,我可以看到在类内部抛出的异常,但是我的处理似乎有效,但是我无法获取自定义消息,并且我的响应代码是200

@GetMapping(path = "/test", produces = "application/json")
public StreamingResponseBody test(@RequestParam(value = "var1") final String test) throws IOException{
    return new StreamingResponseBody() {
        @Override
        public void writeTo(final OutputStream outputStream) throws IOException{
            try {
                // Some operations..
            } catch (Exception MyExceptione e) {
                throw new MyException(e);
            }
        }
    };
}

@ExceptionHandler(MyException.class)
public ResponseEntity handleMyException(MyException exception) {
    return ResponseEntity.status(exception.getHttpStatus()).body(
            ErrorDTO.builder()
                    .message(exception.getMessage())
                    .description(exception.getHttpStatus().getReasonPhrase())
                    .build());
}
Run Code Online (Sandbox Code Playgroud)

我预计我ControllerAdvice会返回500 的ResponseEntityHttp Status