curl-library
Best way to handle libCurl errors in standalone apps
Date: Mon, 31 Aug 2009 15:08:39 +0200
Hi all,
I'm developing a tiny client application which is required to run on a
server as a standalone application. Once this will be started, I'll
have practically no control on it. As a result I would like to build a
robust error handling manager able to deal with any kind of failure
which can occur.
While errors such as:
CURLE_URL_MALFORMAT (3)
The URL was not properly formatted.
CURLE_COULDNT_RESOLVE_HOST (6)
Couldn't resolve host. The given remote host was not resolved.
can be properly managed at runtime, I'm wondering how to deal with errors like:
CURLE_FAILED_INIT (2)
Very early initialization code failed. This is likely to be an
internal error or problem.
CURLE_WRITE_ERROR (23)
An error occurred when writing received data to a local file, or an
error was returned to libcurl from a write callback.
CURLE_READ_ERROR (26)
There was a problem reading a local file or an error returned by the
read callback.
CURLE_ABORTED_BY_CALLBACK (42)
Aborted by callback. A callback returned "abort" to libcurl.
without the need of restarting the client.
I though about tearing down libcurl and initializing it again, hoping
to fix the failure.
My concern is related to any existing easy handle at that moment:
these must be cleaned up or they work with no problem even if libcurl
was reset ?
Or, is there any other suitable way to handle that kind of errors?
Thanks in advance,
Marco Toldo
Received on 2009-08-31