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 .