diff --git a/frontend/packages/dashboard/src/common.js b/frontend/packages/dashboard/src/common.js index 16a37f76..7b6dff74 100644 --- a/frontend/packages/dashboard/src/common.js +++ b/frontend/packages/dashboard/src/common.js @@ -85,12 +85,18 @@ export function bindAsyncForms(onSuccess) { // Errors are surfaced via themedToast; the caller does not re-throw // so asyncBtn's finally always runs (restoring the button). const doSubmit = async () => { - const resp = await fetch(f.action, { - method: f.method || 'POST', - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - body: new URLSearchParams(new FormData(f)), - redirect: 'manual', - }); + let resp; + try { + resp = await fetch(f.action, { + method: f.method || 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: new URLSearchParams(new FormData(f)), + redirect: 'manual', + }); + } catch (err) { + themedToast('action failed: ' + err, { type: 'error' }); + return; + } const ok = resp.ok || resp.type === 'opaqueredirect' || (resp.status >= 200 && resp.status < 400); if (!ok) {