Discussion:
Test for Return Code
Mike Lambert
2018-02-11 01:08:30 UTC
Permalink
Hi,



I am using QB64 basic to access Curl via the shell command .. shell
"Curl.exe etc..". This works beautifully.



How do I test to see if Curl had an error ?



I have read the Curl error return codes . but I don't understand them.



CURLE_OK (0). Does this mean Curl will return an error code of 0 or do I
have to access the variable CURLE_OK and check it.



Regards,



Mike
Jeremy Nicoll
2018-02-11 13:06:54 UTC
Permalink
Post by Mike Lambert
CURLE_OK (0). Does this mean Curl will return an error code of 0 or do I
have to access the variable CURLE_OK and check it.
It means you test for a return code of 0.

Curl probably issues a variety of return codes in different circumstances.
They'll be listed somewhere with their numeric values and symbolic
names. If you were using a language (eg C ?) which had been told to read
the list of symbolic names, you could test for a returned code being equal
to CURLE_OK (or any other symbolic value) and the C compiler would
know that that meant 0 (or whatever). The only advantage in that is that
program logic is possibly easier to understand when numeric error codes
are represented instead by semi-meaningful names.
--
Jeremy Nicoll - my opinions are my own.
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://
Mike Lambert
2018-02-11 22:11:51 UTC
Permalink
Thank you

Mike

-----Original Message-----
From: curl-users [mailto:curl-users-***@cool.haxx.se] On Behalf Of Jeremy Nicoll
Sent: Monday, 12 February 2018 12:07 AM
To: curl-***@cool.haxx.se
Subject: Re: Test for Return Code
Post by Mike Lambert
CURLE_OK (0). Does this mean Curl will return an error code of 0 or do
I have to access the variable CURLE_OK and check it.
It means you test for a return code of 0.

Curl probably issues a variety of return codes in different circumstances.
They'll be listed somewhere with their numeric values and symbolic names. If you were using a language (eg C ?) which had been told to read the list of symbolic names, you could test for a returned code being equal to CURLE_OK (or any other symbolic value) and the C compiler would
know that that meant 0 (or whatever). The only advantage in that is that
program logic is possibly easier to understand when numeric error codes are represented instead by semi-meaningful names.

--
Jeremy Nicoll - my opinions are my own.
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html


-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:
Daniel Stenberg
2018-02-11 22:17:49 UTC
Permalink
Post by Jeremy Nicoll
Curl probably issues a variety of return codes in different circumstances.
They'll be listed somewhere with their numeric values and symbolic
names.
Yeps: https://curl.haxx.se/docs/manpage.html#EXIT
Post by Jeremy Nicoll
If you were using a language (eg C ?) which had been told to read the list
of symbolic names, you could test for a returned code being equal to
CURLE_OK (or any other symbolic value) and the C compiler would know that
that meant 0 (or whatever).
The libcurl error codes are listed here:
https://curl.haxx.se/libcurl/c/libcurl-errors.html
--
/ daniel.haxx.se

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.htm
Loading...