Skip to content

Commit 1e9d0a8

Browse files
feat(web): show the clean error detail on a failed upload
1 parent 5071cda commit 1e9d0a8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

web/app/api.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,9 @@
500500
form.append("file", file);
501501
const res = await fetch("/ingest", { method: "POST", body: form });
502502
if (!res.ok) {
503-
throw new Error(`${res.status} ${res.statusText}: ${await res.text()}`);
503+
let detail = await res.text();
504+
try { detail = JSON.parse(detail).detail || detail; } catch { /* keep raw text */ }
505+
throw new Error(detail);
504506
}
505507
return res.json(); // { paper_id, chunks_added, corpus_chunks }
506508
}

0 commit comments

Comments
 (0)