This commit is contained in:
Mateusz Gruszczyński
2026-09-02 23:10:44 +02:00
parent 563523d2e2
commit 76bbd39378
16 changed files with 196 additions and 57 deletions
+3 -1
View File
@@ -329,7 +329,9 @@ async function api(path, options = {}) {
if (!response.ok) {
let message = tr('error.http', { status: response.status });
try { message = (await response.json()).error || message; } catch (_) { }
throw new Error(message);
const error = new Error(message);
error.status = response.status;
throw error;
}
if (response.status === 204) return null;
return response.json();