delete agent close

This commit is contained in:
lda
2026-04-14 05:49:49 +07:00 Unverified
parent 28dda76ee8
commit 7769db3906
6 changed files with 46 additions and 29 deletions
+4 -5
View File
@@ -72,12 +72,11 @@ async function request<T>(path: string, init?: RequestInit): Promise<T> {
});
if (!res.ok) {
let detail = "";
const raw = await res.text();
let detail = raw;
try {
detail = JSON.stringify(await res.json(), null, 2);
} catch {
detail = await res.text();
}
detail = JSON.stringify(JSON.parse(raw), null, 2);
} catch {}
throw new Error(`${res.status} ${res.statusText}\n${detail}`);
}