We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I haven't found a way to get cURL error code so far. When using EasyInit, it's returning error message string like curl: Couldn't resolve host name.
EasyInit
curl: Couldn't resolve host name
func main() { easy := curl.EasyInit() defer easy.Cleanup() easy.Setopt(curl.OPT_URL, "http://zzzzzzzz---.com") if err := easy.Perform(); err != nil { fmt.Println(err, err.Error()) } }
But, how to get the cURL error code like the libcurl equivalent returns.
libcurl
int main(int argc, char *argv[]) { CURL *easyhandle = curl_easy_init(); curl_easy_setopt(easyhandle, CURLOPT_URL, "http://zzzzzzzz---.com"); int errorCode = curl_easy_perform(easyhandle); printf("Error Code: %d %d\n", errorCode, errorCode == CURLE_COULDNT_RESOLVE_HOST); return 0; }
The text was updated successfully, but these errors were encountered:
This is a bit hacky but you could do the following to extract the int errorCode from the curl error provided by this library.
errornum, convErr := strconv.Atoi(fmt.Sprintf("%d", err.(curl.CurlError) ))
Sorry this is so late, I just ran into this as well ^_^
Sorry, something went wrong.
No branches or pull requests
I haven't found a way to get cURL error code so far. When using
EasyInit
, it's returning error message string likecurl: Couldn't resolve host name
.But, how to get the cURL error code like the
libcurl
equivalent returns.The text was updated successfully, but these errors were encountered: