春がRuntimexceptionsの完全なスタックトレースをフロントエンドに送信しないようにしたい。私はこのようなことをしました:
@ControllerAdvice
public class RestErrorHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(Exception.class)
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
@Override
protected ResponseEntity<Object> handleExceptionInternal(Exception e, Object body,
HttpHeaders headers, HttpStatus status, WebRequest request) {
logger.error("Error happened while executing controller.", e);
return null;
}
}
私の目的は、エラー コードだけをフロント エンドに送信することです。上記のメソッドは、ステータス 200 OK をフロントエンドに返します。null の代わりに何を返す必要がありますか?