debug: add try-catch around iframe render() to catch any JS errors

This commit is contained in:
mirivlad 2026-06-08 13:43:13 +08:00
parent f4a25128ae
commit 4a5dab49b5
2 changed files with 4 additions and 2 deletions

View File

@ -436,7 +436,7 @@ body {
if (msg.categories) state.categories = msg.categories; if (msg.categories) state.categories = msg.categories;
state.eventsLoaded = true; state.eventsLoaded = true;
state.panelReady = true; state.panelReady = true;
render(); try { render(); } catch(e) { try { window.parent.go.main.App.WriteDebugLog('[iframe] render error: ' + String(e) + ' ' + JSON.stringify({message: e.message, stack: e.stack?.substring(0,200)})); } catch(e2) {} }
break; break;
case 'drop': case 'drop':

View File

@ -115,7 +115,9 @@
categories, categories,
}) })
// Confirm delivery via Go log // Confirm delivery via Go log
try { window.go.main.App.WriteDebugLog('[CalendarPluginPage] calendar-data sent to iframe, events=' + events.length + ', categories=' + (categories?.length || 0)) } catch(e) {} try { window.go.main.App.WriteDebugLog('[CalendarPluginPage] calendar-data sent to iframe, events=' + events.length + ', categories=' + (categories?.length || 0)) } catch(e) {
try { window.go.main.App.WriteDebugLog('[CalendarPluginPage] ERROR in WriteDebugLog: ' + String(e) + ' | eventsRaw=' + String(eventsRaw) + ' | typeof eventsRaw=' + typeof eventsRaw + ' | typeof events=' + typeof events + ' | events===' + JSON.stringify(events)) } catch(e2) {}
}
} catch (e) { } catch (e) {
console.error('[CalendarPluginPage] loadCalendarData:', e) console.error('[CalendarPluginPage] loadCalendarData:', e)
console.log('[CalendarPluginPage] error details:', JSON.stringify({message: String(e), stack: e?.stack})) console.log('[CalendarPluginPage] error details:', JSON.stringify({message: String(e), stack: e?.stack}))