src/Bigcommerce/Api/Connection.php
private function handleResponse()
    {
        if (curl_errno($this->curl)) {
            throw new NetworkError(curl_error($this->curl), curl_errno($this->curl));
        }

        $body = ($this->rawResponse) ? $this->getBody() : json_decode($this->getBody());

        $status = $this->getStatus();

        if ($status >= 400 && $status <= 499) {
            if ($this->failOnError) {
                throw new ClientError($body, $status);
            } else {
                $this->lastError = $body;
                return false;
            }
        } elseif ($status >= 500 && $status <= 599) {
            if ($this->failOnError) {
                throw new ServerError($body, $status);
            } else {
                $this->lastError = $body;
                return false;
            }
        }

        if ($this->followLocation) {
            $this->followRedirectPath();
        }

        return $body;
    }
private function handleResponse()
    {
        if (curl_errno($this->curl)) {
            throw new NetworkError(curl_error($this->curl), curl_errno($this->curl));
        }

        $body = ($this->rawResponse) ? $this->getBody() : json_decode($this->getBody());

        $status = $this->getStatus();

        if ($status >= 400 && $status <= 499) {
            if ($this->failOnError) {
                throw new ClientError($body, $status);
            } else {
                $this->lastError = $body;
                return false;
            }
        } elseif ($status >= 500 && $status <= 599) {
            if ($this->failOnError) {
                throw new ServerError($body, $status);
            } else {
                $this->lastError = $body;
                return false;
            }
        }

        if ($this->followLocation) {
            $this->followRedirectPath();
        }

        return $body;
    }
private function handleResponse ( ) { if ( curl_errno ( $ this -> curl ) ) { throw new NetworkError ( curl_error ( $ this -> curl ) , curl_errno ( $ this -> curl ) ) ; } $ body = ( $ this -> rawResponse ) ? $ this -> getBody ( ) : json_decode ( $ this -> getBody ( ) ) ; $ status = $ this -> getStatus ( ) ; if ( $ status >= 400 && $ status <= 499 ) { if ( $ this -> failOnError ) { throw new ClientError ( $ body , $ status ) ; } else { $ this -> lastError = $ body ; return false ; } } elseif ( $ status >= 500 && $ status <= 599 ) { if ( $ this -> failOnError ) { throw new ServerError ( $ body , $ status ) ; } else { $ this -> lastError = $ body ; return false ; } } if ( $ this -> followLocation ) { $ this -> followRedirectPath ( ) ; } return $ body ; }
Check the response for possible errors and handle the response body returned.

If failOnError is true, a client or server error is raised, otherwise returns false
on error.
Check the response for possible errors and handle the response body returned .