add human-readable error messages

This commit is contained in:
Konstantin Käfer
2014-04-15 11:45:26 -04:00
parent e9db888491
commit 8e442411b0
2 changed files with 7 additions and 1 deletions

View File

@@ -101,6 +101,12 @@ void Request::request(void *ptr) {
code = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &res.code);
// Add human-readable error code
if (code != CURLE_OK) {
res.error_message = curl_easy_strerror(code);
res.code = -1;
}
if (code != CURLE_ABORTED_BY_CALLBACK) {
req->background_function(&res);
}