Remove unnecessary error signal from DefaultRestClient

Before UnknownContentTypeException is thrown, it is added to the current
Observation but since UnknownContentTypeException is a
RestClientException, the exception is added again in one of the
catch blocks later on.

Closes gh-33347
This commit is contained in:
Jonatan Ivanov 2024-08-07 19:03:03 -07:00 committed by Stéphane Nicoll
parent 36e84a5209
commit 6c74fee5e8
1 changed files with 2 additions and 5 deletions

View File

@ -220,13 +220,10 @@ final class DefaultRestClient implements RestClient {
return (T) messageConverter.read((Class)bodyClass, responseWrapper);
}
}
UnknownContentTypeException unknownContentTypeException = new UnknownContentTypeException(bodyType, contentType,
throw new UnknownContentTypeException(bodyType, contentType,
responseWrapper.getStatusCode(), responseWrapper.getStatusText(),
responseWrapper.getHeaders(), RestClientUtils.getBody(responseWrapper));
if (observation != null) {
observation.error(unknownContentTypeException);
}
throw unknownContentTypeException;
}
catch (UncheckedIOException | IOException | HttpMessageNotReadableException exc) {
Throwable cause;