mirror of
https://github.com/wasrusgen/zov-tech.git
synced 2026-06-03 15:04:50 +00:00
debug: показывать ошибку в карточке клиента вместо пустого экрана
- Обернуть renderClientHistory в try/catch — показывает текст ошибки - Добавить .catch() в mount() для перехвата unhandled promise rejection - Версия clients.js: 20260518c
This commit is contained in:
parent
860c768572
commit
057842b7e6
@ -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(
|
||||
`<div class="error" style="padding:16px;margin:16px;border-radius:10px;background:#fff3f3;">
|
||||
<b>Ошибка карточки:</b> ${escHtml(e.message)}
|
||||
</div>`
|
||||
));
|
||||
});
|
||||
} 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(
|
||||
`<div class="error" style="padding:16px;margin:12px 16px;border-radius:10px;background:#fff3f3;">
|
||||
<b>Ошибка загрузки карточки:</b><br>${escHtml(e.message)}<br>
|
||||
<small style="color:#999">${escHtml(e.stack ? e.stack.split('\n')[1] || '' : '')}</small>
|
||||
</div>`
|
||||
));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===================== Управление карточкой (edit / delete) ===================== */
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
<script src="assets/podbor.config.js?v=20260516h"></script>
|
||||
<script src="assets/podbor.picts.js?v=20260516h"></script>
|
||||
<script src="assets/podbor.js?v=20260517d"></script>
|
||||
<script src="assets/clients.js?v=20260518b"></script>
|
||||
<script src="assets/clients.js?v=20260518c"></script>
|
||||
<script src="assets/zamer-picts.js?v=20260516h"></script>
|
||||
<script src="assets/measurements.js?v=20260517d"></script>
|
||||
<script src="assets/request.js?v=20260517d"></script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user