diff --git a/src/main.tsx b/src/main.tsx index 8ce3ce7..80698ca 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -55,6 +55,21 @@ import '@fontsource/barlow-condensed/700.css'; } })(); +// Global error trap — shows error on screen in the APK so we can debug +// without needing USB/adb. Remove once white screen is fixed. +window.onerror = (msg, src, line, col, err) => { + const div = document.createElement('div'); + div.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:#000;color:#ff0040;padding:16px;font:14px monospace;z-index:99999;overflow:auto;white-space:pre-wrap;word-break:break-all;'; + div.textContent = `ERROR:\n${msg}\n\n${src}:${line}:${col}\n\n${err?.stack || ''}`; + document.body.appendChild(div); +}; +window.onunhandledrejection = (e) => { + const div = document.createElement('div'); + div.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:#000;color:#ff6600;padding:16px;font:14px monospace;z-index:99999;overflow:auto;white-space:pre-wrap;word-break:break-all;'; + div.textContent = `UNHANDLED REJECTION:\n${e.reason?.stack || e.reason || 'unknown'}`; + document.body.appendChild(div); +}; + createRoot(document.getElementById("root")!).render(