public static <T> T execute(Single<T> apiCall) {
        try {
            return apiCall.blockingGet();
        } catch (HttpException e) {
            try {
                if (e.response() == null || e.response().errorBody() == null) {
                    throw e;
                }
                String errorBody = e.response().errorBody().string();

                OpenAiError error = mapper.readValue(errorBody, OpenAiError.class);
                throw new OpenAiHttpException(error, e, e.code());
            } catch (IOException ex) {
                // couldn't parse OpenAI error
                throw e;
            }
        }
    }
@Test
    void executeNullErrorBodyThrowOriginalError() {
        // exception with a successful response creates an error without an error body
        HttpException httpException = new HttpException(Response.success(new CompletionResult()));
        Single<CompletionResult> single = Single.error(httpException);

        HttpException exception = assertThrows(HttpException.class, () -> OpenAiService.execute(single));
    }