Add upload response status logging to handleImageUpload

Help diagnose why uploads succeed but show "Upload failed" error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kunthawat Greethong
2026-05-04 11:04:04 +07:00
parent 73cce1b593
commit 881657c59a

View File

@@ -1241,8 +1241,10 @@ export function renderToolbar(config: ToolbarConfig): string {
});
})
.then(function(r) {
console.log("[emdash] Upload response status:", r.status);
if (!r.ok) {
return r.json().then(function(e) {
console.log("[emdash] Upload error response:", JSON.stringify(e));
var msg = (e && e.error && e.error.message) ? e.error.message : ("Upload failed: " + r.status);
throw new Error(msg);
});