Remove fatal error overlay
This commit is contained in:
parent
0f3d18950a
commit
9ae743364a
31
src/main.jsx
31
src/main.jsx
|
|
@ -21,37 +21,6 @@ import { AuthProvider } from "./auth/AuthContext.jsx";
|
||||||
// Import pour PWA install
|
// Import pour PWA install
|
||||||
import { promptInstall } from './pwaInstall';
|
import { promptInstall } from './pwaInstall';
|
||||||
|
|
||||||
function installGlobalErrorOverlay() {
|
|
||||||
if (typeof window === "undefined") return;
|
|
||||||
const show = (msg) => {
|
|
||||||
try {
|
|
||||||
let el = document.getElementById("sw-fatal");
|
|
||||||
if (!el) {
|
|
||||||
el = document.createElement("div");
|
|
||||||
el.id = "sw-fatal";
|
|
||||||
el.style.position = "fixed";
|
|
||||||
el.style.inset = "0";
|
|
||||||
el.style.background = "#0b0f1a";
|
|
||||||
el.style.color = "#e2e8f0";
|
|
||||||
el.style.zIndex = "999999";
|
|
||||||
el.style.padding = "24px";
|
|
||||||
el.style.fontFamily = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace";
|
|
||||||
el.style.whiteSpace = "pre-wrap";
|
|
||||||
document.body.appendChild(el);
|
|
||||||
}
|
|
||||||
el.textContent = `SocioWire error:\\n${msg}`;
|
|
||||||
} catch {}
|
|
||||||
};
|
|
||||||
window.addEventListener("error", (e) => {
|
|
||||||
show(e?.message || String(e));
|
|
||||||
});
|
|
||||||
window.addEventListener("unhandledrejection", (e) => {
|
|
||||||
show(e?.reason?.message || String(e?.reason || e));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
installGlobalErrorOverlay();
|
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById("root")).render(
|
ReactDOM.createRoot(document.getElementById("root")).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<AuthProvider>
|
<AuthProvider>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue