diff --git a/miniapp/assets/clients.js b/miniapp/assets/clients.js index ca10d9b..52300c7 100644 --- a/miniapp/assets/clients.js +++ b/miniapp/assets/clients.js @@ -29,7 +29,13 @@ const Clients = (function () { renderClientProposalsPage(clientKey); } else if (sub.startsWith("client/")) { const clientKey = decodeURIComponent(sub.slice(7)); - renderClientHistory(clientKey); + renderClientHistory(clientKey).catch(e => { + if (root) root.appendChild(el( + `
+ Ошибка карточки: ${escHtml(e.message)} +
` + )); + }); } else { renderList(); } @@ -565,7 +571,7 @@ const Clients = (function () { async function renderClientHistory(clientKey) { root.innerHTML = ""; root.appendChild(headerEl("Карточка клиента", "#/clients")); - + try { // Берём из кеша если есть let clients = clientsCache?.clients; if (!clients) { @@ -753,6 +759,15 @@ const Clients = (function () { proposalPlaceholder.replaceWith(propWrapper); // (управление перенесено наверх — сразу под шапку) + } catch (e) { + root.appendChild(el( + `
+ Ошибка загрузки карточки:
${escHtml(e.message)}
+ ${escHtml(e.stack ? e.stack.split('\n')[1] || '' : '')} +
` + )); + throw e; + } } /* ===================== Управление карточкой (edit / delete) ===================== */ diff --git a/miniapp/index.html b/miniapp/index.html index ef6dc66..604e0fb 100644 --- a/miniapp/index.html +++ b/miniapp/index.html @@ -39,7 +39,7 @@ - +