Package org.springframework.web.client

# Interface ResponseErrorHandler

All Known Implementing Classes:
  `DefaultResponseErrorHandler`, `ExtractingResponseErrorHandler`, `NoOpResponseErrorHandler`

public interface ResponseErrorHandler
Strategy interface used by the `RestTemplate` and `RestClient` to determine whether a particular response has an error or not.

Note that `RestClient` also supports and recommends use of `status handlers`.

Since:
  3.0
Author:
  Arjen Poutsma

## Method Summary

Modifier and Type
Method
Description
`default void`
`handleError(URI url, HttpMethod method, ClientHttpResponse response)`
Handle the error in the given response.
`default void`
`handleError(ClientHttpResponse response)`
Deprecated, for removal: This API element is subject to removal in a future version.
in favor of `handleError(URI, HttpMethod, ClientHttpResponse)`
`boolean`
`hasError(ClientHttpResponse response)`
Indicate whether the given response has any errors.

## Method Details

### hasError

boolean hasError(ClientHttpResponse response) throws IOException
Indicate whether the given response has any errors.

Implementations will typically inspect the `HttpStatus` of the response.

Parameters:
  `response` - the response to inspect
Returns:
  `true` if the response indicates an error; `false` otherwise
Throws:
  `IOException` - in case of I/O errors

### handleError

default void handleError(URI url, HttpMethod method, ClientHttpResponse response) throws IOException
Handle the error in the given response.

This method is only called when `hasError(ClientHttpResponse)` has returned `true`.

Parameters:
  `url` - the request URL
  `method` - the HTTP method
  `response` - the response with the error
Throws:
  `IOException` - in case of I/O errors
Since:
  5.0

### handleError

@Deprecated(since="6.2.2", forRemoval=true) default void handleError(ClientHttpResponse response) throws IOException
Deprecated, for removal: This API element is subject to removal in a future version.
in favor of `handleError(URI, HttpMethod, ClientHttpResponse)`
Handle the error in the given response.

This method is only called when `hasError(ClientHttpResponse)` has returned `true`.

Parameters:
  `response` - the response with the error
Throws:
  `IOException` - in case of I/O errors