Code example for DefaultResponseErrorHandler

0
/** 
 * Subclass of {@link DefaultResponseErrorHandler} that handles errors from VKontakte's 
 * API, interpreting them into appropriate exceptions. 
 * @author vkolodrevskiy 
 */ 
public class VKontakteErrorHandler extends DefaultResponseErrorHandler {
	@Override 
	public void handleError(ClientHttpResponse response) throws IOException {
		HttpStatus statusCode = response.getStatusCode();
		if (statusCode.series() == HttpStatus.Series.SERVER_ERROR) {
			handleServerErrors(statusCode);
		} else if (statusCode.series() == HttpStatus.Series.CLIENT_ERROR) {
			handleClientErrors(response);
		} 
 
		// if not otherwise handled, do default handling and wrap with UncategorizedApiException 
		try { 
			super.handleError(response);
		} catch(Exception e) {
			throw new UncategorizedApiException("vkontakte", "Error consuming VKontakte REST API", e);
Connect your IDE to all the code out there  Get Codota for Java