input/curl: use new class HttpStatusError

This way, IsFileNotFound() can detect status 404.
This commit is contained in:
Max Kellermann
2018-07-06 19:26:11 +02:00
parent b8259e604a
commit 466625f7ad
4 changed files with 55 additions and 1 deletions

View File

@@ -19,6 +19,7 @@
#include "config.h"
#include "CurlInputPlugin.hxx"
#include "lib/curl/Error.hxx"
#include "lib/curl/Easy.hxx"
#include "lib/curl/Global.hxx"
#include "lib/curl/Request.hxx"
@@ -188,7 +189,9 @@ CurlInputStream::OnHeaders(unsigned status,
assert(!postponed_exception);
if (status < 200 || status >= 300)
throw FormatRuntimeError("got HTTP status %ld", status);
throw HttpStatusError(status,
StringFormat<40>("got HTTP status %u",
status).c_str());
const std::lock_guard<Mutex> protect(mutex);