debug: add detailed error logging to buildAndEmitBookmarks

Added logging at each step:
- Before calling collectBookmarksFromEvents
- After collectBookmarksFromEvents returns
- Detailed error info if it fails (message + stack)

This will show us exactly where the silent failure is happening.
This commit is contained in:
Gigi
2025-10-17 23:28:38 +02:00
parent 51b7e53385
commit 3f24ccff74

View File

@@ -117,9 +117,11 @@ class BookmarkController {
}
try {
console.log('[controller] 🔧 Calling collectBookmarksFromEvents with', readyEvents.length, 'events')
// Collect bookmarks from ready events only
const { publicItemsAll, privateItemsAll, newestCreatedAt, latestContent, allTags } =
await collectBookmarksFromEvents(readyEvents, activeAccount, signerCandidate)
console.log('[controller] 🔧 collectBookmarksFromEvents returned:', publicItemsAll.length, 'public,', privateItemsAll.length, 'private')
const allItems = [...publicItemsAll, ...privateItemsAll]
@@ -231,6 +233,8 @@ class BookmarkController {
this.bookmarksListeners.forEach(cb => cb([bookmark]))
} catch (error) {
console.error('[controller] ❌ Failed to build bookmarks:', error)
console.error('[controller] ❌ Error details:', error instanceof Error ? error.message : String(error))
console.error('[controller] ❌ Stack:', error instanceof Error ? error.stack : 'no stack')
this.bookmarksListeners.forEach(cb => cb([]))
}
}