Add try/catch + alert on modal save button to surface hidden errors
This commit is contained in:
parent
45341ddba4
commit
1f53b8fcc2
1 changed files with 7 additions and 2 deletions
|
|
@ -839,8 +839,13 @@ function showModal(html, onSubmit) {
|
|||
overlay.querySelector("#modal-back").onclick = () => closeModal();
|
||||
overlay.querySelector("#modal-cancel").onclick = () => closeModal();
|
||||
overlay.querySelector("#modal-ok").onclick = async () => {
|
||||
const ok = await onSubmit(overlay);
|
||||
if (ok !== false) { closeModal(); if (ok !== "norender") renderScreen(state.screen); }
|
||||
try {
|
||||
const ok = await onSubmit(overlay);
|
||||
if (ok !== false) { closeModal(); if (ok !== "norender") renderScreen(state.screen); }
|
||||
} catch (e) {
|
||||
console.error("[showModal] onSubmit error:", e);
|
||||
alert("Ошибка: " + e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue