code: protected function createErrorException( ResponseInterface $response ){
  
          $body = json_decode($response->getBody(), true);
  
          $message = "HTTP:{$response->getStatusCode()} - ";
          $message .= (is_array($body)) ? print_r($body, true) : 'Unexpected response from server';
  
          return new Exception\ApiException( $message, $response->getStatusCode(), $response );
  
      }
docs: Called with a response from the API when the response code was unsuccessful. i.e. not 20X.
  
  @param ResponseInterface $response
  
  @return Exception\ApiException