private function handleHttpError()
    {
        $msg = 'HTTP API Error (HTTP response code was '.$this->state['response']['code'].')';
        switch ($this->state['response']['code']) {
            case 404:
                throw new InvalidRequestException($msg, $this->state);
            case 401:
                throw new ApiAuthenticationException($msg, $this->state);
            default:
                throw new ApiException($msg, $this->state);
        }
    }