On 10/24/23 14:18, Vladimir Levijev via curl-library wrote:
On 24 Oct 2023, at 13:55, Patrick Schlangen <[email protected]> wrote:
Hi,
Am 24.10.2023 um 12:24 schrieb Vladimir Levijev via curl-library
<[email protected]>:
So I tried it with #define but then you deal with static name of the error
buffer and the GOTO label (in some parts we use it, but not everythere).
not exactly nice, but this might do the trick:
#define my_setopt(handle, option, ...) (last_option = #option,
curl_easy_setopt(handle, option, __VA_ARGS__))
void foo() {
const char *last_option = "none";
// ...
if (!my_setopt(e, CURLOPT_FOO, 123)) {
printf("Error in %s!\n", last_option);
}
}
Thanks a lot! That works, definitely will consider this one!
There is also:
curl_easy_setopt(e, CURLOPT_ERRORBUFFER, curl_error_message);
I did not try, but I would expect curl to complain that option 123 is
not supported in this case.
Regards,
-- Marc
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html