-
Notifications
You must be signed in to change notification settings - Fork 383
Closed
Milestone
Description
I think need to add more details when an error occurs. If restclient couldn't connect to the host or resolve the domain, then there is almost no information. There is only an uninformative error 'Failed to query' and -1 status code.
Curl library has good functionality about many errors, but it is not used.
https://github.com/mrtazz/restclient-cpp/blob/master/source/connection.cc#L444
Maybe add more curl errors?
switch (res) {
case CURLE_OPERATION_TIMEDOUT:
ret.code = res;
ret.body = "Operation Timeout.";
break;
case CURLE_SSL_CERTPROBLEM:
case CURLE_FAILED_INIT:
case CURLE_URL_MALFORMAT:
case CURLE_NOT_BUILT_IN:
case CURLE_COULDNT_RESOLVE_PROXY:
case CURLE_COULDNT_RESOLVE_HOST:
case CURLE_COULDNT_CONNECT:
// ...
ret.code = res;
ret.body = curl_easy_strerror(res);
break;
default:
ret.body = "Failed to query.";
ret.code = -1;
}List of all curl error here https://curl.haxx.se/libcurl/c/libcurl-errors.html
If you want, I can create PR.
Spencatro
Metadata
Metadata
Assignees
Labels
No labels