protected function throwRequestException(RequestException $requestException)
    {
        $exceptionParts = $this->getRequestExceptionParts($requestException);

        $exception = new Exceptions\Exception(
            $exceptionParts['reason'],
            $exceptionParts['code'],
            $requestException
        );

        $body = $exceptionParts['body'];
        $json = json_decode($body);

        if (json_last_error() == JSON_ERROR_NONE) {
            throw $exception->setResponseBody($json);
        }

        throw $exception->setResponseBody($body);
    }