public function handleErrorResponse(HttpResponse $response, $options = []) {
        if ($options['throw'] ?? $this->throwExceptions) {
            $body = $response->getBody();
            if (is_array($body)) {
                $message = $body['message'] ?? $response->getReasonPhrase();
            } else {
                $message = $response->getReasonPhrase();
            }
            throw new HttpResponseException($response, $message);
        }
    }
public function handleErrorResponse(HttpResponse $response, $options = []) {
        if ($options['throw'] ?? $this->throwExceptions) {
            $body = $response->getBody();
            if (is_array($body)) {
                $message = $body['message'] ?? $response->getReasonPhrase();
            } else {
                $message = $response->getReasonPhrase();
            }
            throw new HttpResponseException($response, $message);
        }
    }
public function handleErrorResponse ( HttpResponse $ response , $ options = [ ] ) { if ( $ options [ 'throw' ] ?? $ this -> throwExceptions ) { $ body = $ response -> getBody ( ) ; if ( is_array ( $ body ) ) { $ message = $ body [ 'message' ] ?? $ response -> getReasonPhrase ( ) ; } else { $ message = $ response -> getReasonPhrase ( ) ; } throw new HttpResponseException ( $ response , $ message ) ; } }
Handle a non 200 series response from the API.

This method is here specifically for sub-classes to override. When an API call is made and a non-200 series
status code is returned then this method is called with that response. This lets API client authors to extract
the appropriate error message out of the response and decide whether or not to throw a PHP exception.

It is recommended that you obey the caller's wishes on whether or not to throw an exception by using the
following `if` statement:

```php
if ($options['throw'] ?? $this->throwExceptions) {
...
}
```

@param HttpResponse $response The response sent from the API.
@param array $options The options that were sent with the request.
@throws HttpResponseException Throws an exception if the settings or options say to throw an exception.
Handle a non 200 series response from the API .