1 package org.onap.nbi.exceptions;
3 import org.springframework.http.client.ClientHttpResponse;
4 import org.springframework.web.client.DefaultResponseErrorHandler;
5 import org.springframework.web.client.ResponseErrorHandler;
7 import java.io.IOException;
9 public class BackendErrorHandler implements ResponseErrorHandler {
11 private ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();
14 public boolean hasError(ClientHttpResponse response) throws IOException {
15 return errorHandler.hasError(response);
19 public void handleError(ClientHttpResponse response) throws IOException {
20 if (response.getStatusCode() != null) {
21 throw new BackendFunctionalException(response.getStatusCode(), response.getStatusText());