From d5bf128ceef6cfdeb029f1ab2ce4a9a73618f5cc Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Mon, 22 May 2023 18:56:32 +0200
Subject: [PATCH] storage/curl: throw HttpStatusError

---
 src/storage/plugins/CurlStorage.cxx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/storage/plugins/CurlStorage.cxx b/src/storage/plugins/CurlStorage.cxx
index 1a6578f68..62107b536 100644
--- a/src/storage/plugins/CurlStorage.cxx
+++ b/src/storage/plugins/CurlStorage.cxx
@@ -22,6 +22,7 @@
 #include "storage/StorageInterface.hxx"
 #include "storage/FileInfo.hxx"
 #include "storage/MemoryDirectoryReader.hxx"
+#include "lib/curl/Error.hxx"
 #include "lib/curl/Init.hxx"
 #include "lib/curl/Global.hxx"
 #include "lib/curl/Slist.hxx"
@@ -300,8 +301,9 @@ private:
 	/* virtual methods from CurlResponseHandler */
 	void OnHeaders(unsigned status, Curl::Headers &&headers) final {
 		if (status != 207)
-			throw FormatRuntimeError("Status %d from WebDAV server; expected \"207 Multi-Status\"",
-						 status);
+			throw HttpStatusError(status,
+					      StringFormat<80>("Status %u from WebDAV server; expected \"207 Multi-Status\"",
+							       status).c_str());
 
 		if (!IsXmlContentType(headers))
 			throw std::runtime_error("Unexpected Content-Type from WebDAV server");