Add better error handling for WebDAV backup response

Parse response as text first, then JSON to capture server errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Purple
2026-01-18 13:44:44 +00:00
parent c67d7ff139
commit 1421e8fdaa

View File

@@ -1606,7 +1606,15 @@ async function backupToWebDAV() {
})
});
const data = await response.json();
const text = await response.text();
let data;
try {
data = JSON.parse(text);
} catch (parseError) {
console.error("Failed to parse response:", text);
throw new Error("Server returned invalid response. Check error logs.");
}
if (!data.success) {
throw new Error(data.error || "WebDAV backup failed");
}