mirror of
https://github.com/Syping/dtranslatebot.git
synced 2026-04-21 14:40:41 +02:00
curl_exception: add error() function and improve message handling
This commit is contained in:
parent
2282c2875c
commit
481a2a8357
3 changed files with 13 additions and 8 deletions
|
|
@ -40,7 +40,7 @@ const http_response http_request::get(const std::string &url, const http_headers
|
|||
curl_easy_getinfo(instance, CURLINFO_RESPONSE_CODE, &response.status);
|
||||
curl_easy_reset(instance);
|
||||
return result == CURLE_OK ?
|
||||
response : throw bot::exception::curl_exception(strlen(error) ? error : curl_easy_strerror(result), result);
|
||||
response : throw bot::exception::curl_exception(error, result);
|
||||
}
|
||||
|
||||
const http_response http_request::post(const std::string &url, const std::string &content, const http_headers &headers) {
|
||||
|
|
@ -58,7 +58,7 @@ const http_response http_request::post(const std::string &url, const std::string
|
|||
curl_easy_getinfo(instance, CURLINFO_RESPONSE_CODE, &response.status);
|
||||
curl_easy_reset(instance);
|
||||
return result == CURLE_OK ?
|
||||
response : throw bot::exception::curl_exception(strlen(error) ? error : curl_easy_strerror(result), result);
|
||||
response : throw bot::exception::curl_exception(error, result);
|
||||
}
|
||||
|
||||
std::string http_request::legacy_url(const std::string &hostname, uint16_t port, const std::string &url, bool tls) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue