lib/curl/Easy: add method TrySetOption()
This commit is contained in:
parent
cbd031ca7f
commit
997311ba14
@ -63,9 +63,14 @@ public:
|
|||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
CURLcode TrySetOption(CURLoption option, T value) noexcept {
|
||||||
|
return curl_easy_setopt(handle, option, value);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void SetOption(CURLoption option, T value) {
|
void SetOption(CURLoption option, T value) {
|
||||||
CURLcode code = curl_easy_setopt(handle, option, value);
|
CURLcode code = TrySetOption(option, value);
|
||||||
if (code != CURLE_OK)
|
if (code != CURLE_OK)
|
||||||
throw Curl::MakeError(code, "Failed to set option");
|
throw Curl::MakeError(code, "Failed to set option");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user