curl-library
Re: Empty error message "Error setting curl:"
Date: Mon, 11 Feb 2013 13:51:43 +0100 (CET)
On Mon, 11 Feb 2013, Brilliantov Kirill Vladimirovich wrote:
> #define curl_easy_setopt_or_die(handle, option, ...) \
> do {\
> CURLcode res = curl_easy_setopt(handle, option, __VA_ARGS__);\
> if (res != CURLE_OK) {\
> fprintf(stderr, "Error setting curl: %s (%d)\n", error_buf, __LINE__);\
> exit(1);\
> }\
> }while(0)
> I add output line number for found error place.
> Why I not get human readable error messages if CURLOPT_ERRORBUFFER point to
> buffer for error message?
libcurl *may* store error message there - which is explained by the man page.
A slightly better approach for that macro would be to check for a zero-length
string there and if so, use curl_easy_strerror() to get a decent message to
show. Or just show the error code.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2013-02-11