input/curl: use C++ exceptions instead of class Error
This commit is contained in:
parent
0fdaca17a2
commit
7acd91331c
@ -255,7 +255,6 @@ static bool verify_peer, verify_host;
|
|||||||
|
|
||||||
static CurlMulti *curl_multi;
|
static CurlMulti *curl_multi;
|
||||||
|
|
||||||
static constexpr Domain http_domain("http");
|
|
||||||
static constexpr Domain curl_domain("curl");
|
static constexpr Domain curl_domain("curl");
|
||||||
static constexpr Domain curlm_domain("curlm");
|
static constexpr Domain curlm_domain("curlm");
|
||||||
|
|
||||||
@ -430,7 +429,7 @@ inline void
|
|||||||
CurlInputStream::RequestDone(CURLcode result, long status)
|
CurlInputStream::RequestDone(CURLcode result, long status)
|
||||||
{
|
{
|
||||||
assert(io_thread_inside());
|
assert(io_thread_inside());
|
||||||
assert(!postponed_error.IsDefined());
|
assert(!postponed_exception);
|
||||||
|
|
||||||
FreeEasy();
|
FreeEasy();
|
||||||
AsyncInputStream::SetClosed();
|
AsyncInputStream::SetClosed();
|
||||||
@ -438,12 +437,11 @@ CurlInputStream::RequestDone(CURLcode result, long status)
|
|||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
|
|
||||||
if (result != CURLE_OK) {
|
if (result != CURLE_OK) {
|
||||||
postponed_error.Format(curl_domain, result,
|
postponed_exception = std::make_exception_ptr(FormatRuntimeError("curl failed: %s",
|
||||||
"curl failed: %s", error_buffer);
|
error_buffer));
|
||||||
} else if (status < 200 || status >= 300) {
|
} else if (status < 200 || status >= 300) {
|
||||||
postponed_error.Format(http_domain, status,
|
postponed_exception = std::make_exception_ptr(FormatRuntimeError("got HTTP status %ld",
|
||||||
"got HTTP status %ld",
|
status));
|
||||||
status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSeekPending())
|
if (IsSeekPending())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user