(payload: { location: string; message: string; data?: Record<string, unknown> })
| 88 | w[flag] = true; |
| 89 | |
| 90 | const scheduleCrashLog = (payload: { location: string; message: string; data?: Record<string, unknown> }) => { |
| 91 | // Always persist uncaught errors so they appear in webview.log for diagnostics. |
| 92 | // Mark white-screen crashes separately to allow callers to deduplicate. |
| 93 | queueMicrotask(() => { |
| 94 | requestAnimationFrame(() => { |
| 95 | requestAnimationFrame(() => { |
| 96 | const isWhiteScreen = isRootEmpty(); |
| 97 | const crashType = isWhiteScreen ? 'white-screen' : 'page-error'; |
| 98 | // Deduplicate only white-screen crashes to avoid duplicate startup logs. |
| 99 | if (isWhiteScreen && hasLoggedWhiteScreenCrash()) { |
| 100 | return; |
| 101 | } |
| 102 | if (isWhiteScreen) { |
| 103 | markWhiteScreenCrashLogged(); |
| 104 | } |
| 105 | log.error(`[CRASH:${crashType}] Uncaught error`, { |
| 106 | location: payload.location, |
| 107 | message: payload.message, |
| 108 | ...payload.data, |
| 109 | }); |
| 110 | }); |
| 111 | }); |
| 112 | }); |
| 113 | }; |
| 114 | |
| 115 | window.addEventListener( |
| 116 | 'error', |
no test coverage detected