Commit 7acd9133 authored by Max Kellermann's avatar Max Kellermann

input/curl: use C++ exceptions instead of class Error

parent 0fdaca17
...@@ -255,7 +255,6 @@ static bool verify_peer, verify_host; ...@@ -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 ...@@ -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) ...@@ -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())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment