Skip to content

Commit

Permalink
fix: 修复导航页报错,以及异常捕获优化
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Mar 9, 2025
1 parent 4c62b1f commit 322ffd4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
18 changes: 11 additions & 7 deletions packages/web/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ window.addEventListener('error', function (e) {
window.addEventListener('unhandledrejection', function (e) {
e.promise.catch((e) => {
console.error(e);
if (errorFilter(e)) {
return;
try {
if (errorFilter(String(e))) {
return;
}
remote.logger.call('error', '未捕获的异步错误', e);
notify('未捕获的异步错误', e, 'render-error', {
type: 'error',
copy: true
});
} catch (e) {
console.error(e);
}
remote.logger.call('error', '未捕获的异步错误', e);
notify('未捕获的异步错误', e, 'render-error', {
type: 'error',
copy: true
});
});
});

Expand Down
8 changes: 4 additions & 4 deletions packages/web/src/pages/bookmarks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ onMounted(async () => {
const nameEl = document.querySelector('#browser-name');
const tagsEl = document.querySelector('#browser-tags');
const notesEl = document.querySelector('#browser-notes');
console.log(document.querySelector('#data-slot')?.textContent);
const { name, tags, notes } = JSON.parse(document.querySelector('#data-slot')?.textContent || '{}');
if (nameEl && tagsEl && notesEl) {
const dataTextContent = document.querySelector('#data-slot')?.textContent || '';
console.log('data-slot', dataTextContent);
if (nameEl && tagsEl && notesEl && dataTextContent) {
const { name = '', tags = [], notes = '' } = JSON.parse(dataTextContent || '{}');
nameEl.innerHTML = name || '未知名称';
tagsEl.innerHTML = tags.map(
(t) => `<span style="background-color: ${t.color};" class="browser-tag">${t.name}</span>`
Expand Down

0 comments on commit 322ffd4

Please # to comment.