feat: Display detailed submission errors to user

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2025-11-21 22:56:48 +00:00
parent b2ec85cfa5
commit 7523426f15
2 changed files with 9 additions and 5 deletions

View File

@@ -17,13 +17,17 @@ function Submit() {
data.append('url', url);
fetch('/api/submit', { method: 'POST', body: data })
.then(res => res.json())
.then(res => res.json().then(data => ({ ok: res.ok, data })))
.then(
(result) => {
history.replace('/' + result.nid);
({ ok, data }) => {
if (ok) {
history.replace('/' + data.nid);
} else {
setProgress(data.error || 'An unknown error occurred.');
}
},
(error) => {
setProgress('Error');
setProgress(`Error: ${error.toString()}`);
}
);
}