Code example for DefaultResponseErrorHandler

0
import org.springframework.web.client.DefaultResponseErrorHandler;
 
import java.io.IOException;
import java.util.Map;
 
public class YammerErrorHandler extends DefaultResponseErrorHandler {
 
	private static final String RATE_LIMIT_EXCEEDED_MESSAGE_TEXT = "Rate limited due to excessive requests.";
	private static final String ERROR_MESSAGE_KEY = "message";
 
 
	@Override 
	public void handleError(ClientHttpResponse response) throws IOException {
		HttpStatus statusCode = response.getStatusCode();
		if (statusCode.series() == Series.SERVER_ERROR) {
			handleServerErrors(statusCode);
		} else if (statusCode.series() == Series.CLIENT_ERROR) {
			handleClientErrors(response);
		}