cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Function Callback for Error Messages

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 20 Nov 2007 10:32:48 +0100 (CET)

On Tue, 20 Nov 2007, Naiem Shaik wrote:

> Curl provides an option of calling curl_easy_setopt with CURLOPT_ERRORBUFFER
> for providing error messages if any, but is there any callback I can
> register that would be called when error occurs.

No, but every function libcurl provides also returns an error code on errors.

> Because currently by registering with CURLOPT_ERRORBUFFER, I am not sure
> when CURL would write error message into it.

Write a zero to the first byte before invoking libcurl, then you can check the
first byte for non-zero to see if there's a string stored there.

The plan and intent is to always provide an error message when an error is
returned, but that isn't really the case (yet).

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-11-20