protected void assertResponseCode(Request request, Response response) {
    int statusCode = response.code();
    String customMessage = config.getErrorMessages().get(statusCode);

    if (response.isSuccessful()) {
      return;
    } else if (customMessage != null) {
      throw requestFailure(request, createStatus(statusCode, combineMessages(customMessage, createStatus(response))));
    } else {
      throw requestFailure(request, createStatus(response));
    }
  }
protected void assertResponseCode ( Request request , Response response ) { int statusCode = response . code ( ) ; String customMessage = config . getErrorMessages ( ) . get ( statusCode ) ; if ( response . isSuccessful ( ) ) { return ; } else if ( customMessage != null ) { throw requestFailure ( request , createStatus ( statusCode , combineMessages ( customMessage , createStatus ( response ) ) ) ) ; } else { throw requestFailure ( request , createStatus ( response ) ) ; } }
Checks if the response status code is the expected and throws the appropriate KubernetesClientException if not.

@param request            The {#link Request} object.
@param response           The {@link Response} object.
@throws KubernetesClientException When the response code is not the expected.