curl / Mailing Lists / curl-users / Single Mail

curl-users

Re: Question on CURLE_RECV_ERROR (56)

From: Malcolm MacArthur via curl-users <curl-users_at_cool.haxx.se>
Date: Thu, 4 Jan 2018 22:42:35 +0000

On Wed, Jan 3, 2018 at 6:13 AM, ghanashyam satpathy via curl-users <
curl-users_at_cool.haxx.se> wrote:

>
> *Any idea how to get correct error code in such scenario. It should return
> something Access Denied or Authentication failed..*
>
> *Thanks*
>
> There is an old saying ...

"To err is human, but to really f*** things up you need a computer"

Or to put it another way, expect the unexpected. Handle every error you
might receive, because you never know what will happen. The network
connection could fail partway through transmission, or negotiation. The
error you get could be completely different from what you expect. And, as
Daniel pointed out, you don't necessarily know why that happened as
circumstances could be out of your control especially if you are handing
this off to a third party ...

So, in error handling, handle what you specifically know about first, and
then at the tail end, handle anything else. Log as much as you can (perhaps
via an option you selectively turn on ... I once worked with a subdivision
of my company that disabled ALL error message reporting by default on a VMS
system, making troubleshooting ... troublesome ... as you had to go back,
turn on the error messages, and then see what happened, assuming the fault
was reproducible) and recognise that things can fail in the most unexpected
way. A failing disk leads to a DLL failing to load leading to application
startup/initialisation errors, for example. Never expect the application
you're calling to also always have the 'full picture' and be able to give
an accurate error... That's just real life. The more you log, the better
chance you have at troubleshooting ...

And, good luck :)

Malcolm

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-01-04