private function assertCurlResult($curl, $result, $descriptor)
    {
        if ($result === false) {
            $error = curl_error($curl);
            @curl_close($curl);
            throw new RequestError($error, $descriptor);
        }
        @curl_close($curl);
        return $result;
    }