fix: a Kanban form's own check shows as a notice, not as an error for Sentry (DTF-WEB-Z)
Some checks failed
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled

The coupon form checks its code on save and throws a plain Error with
the reason; formDialog showed every error in red, so a typing mistake
became an issue. A plain Error without an API status is now a notice;
the API's refusals (already reported by apiError) and broken code stay
red and reach Sentry.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-18 12:19:16 -03:00
parent 9bbfa42cd4
commit a52856f3f6

View File

@@ -940,7 +940,13 @@ function formDialog(title,{text,fields=[],label='Salvar',tone='pri',host,width,n
const form=m.box;if(className)form.classList.add(className);
cancel.onclick=()=>m.close();
form.onsubmit=async e=>{e.preventDefault();save.disabled=true;
try{if(await onsave(form)!==false)m.close();}catch(err){say(err.message,true);}finally{save.disabled=false;}};
// A plain Error without an API status is the form's own check ("O código
// precisa ter de 3 a 30 letras"): guidance, not a failure, so it stays out
// of Sentry (DTF-WEB-Z). The API's refusals (apiError already reports
// them) and broken code (TypeError and the like) stay red.
try{if(await onsave(form)!==false)m.close();}
catch(err){say(err.message,!(err?.constructor===Error&&err.status===undefined));}
finally{save.disabled=false;}};
return m;
}
// The old name, for the dialogs of Usuários and the rework.