Улучшена обработка ошибок

This commit is contained in:
Book Pauk
2022-12-09 16:49:47 +07:00
parent c17b696d61
commit 48b973d384

View File

@@ -21,6 +21,7 @@ class SearchPage extends BasePage {
let entry = [];
if (query.type) {
if (['author', 'series', 'title'].includes(query.type)) {
try {
const from = query.type;
const page = query.page;
@@ -54,7 +55,16 @@ class SearchPage extends BasePage {
id: 'next_page',
title: '[Следующая страница]',
link: this.navLink({href: `/${this.id}?type=${from}&term=${encodeURIComponent(query.term)}&page=${page + 1}`}),
}),
})
);
}
} catch(e) {
entry.push(
this.makeEntry({
id: 'error',
title: `Ошибка: ${e.message}`,
link: this.navLink({href: `/fake-error-link`}),
})
);
}
}