event-horizon / src /boot-error.js
maxdemarzi's picture
Deploy 4ed0390343adb220188e58f95ab1a8e7e1dd995e (manual: Actions blocked on billing) (part 2)
1b9ed71 verified
Raw
History Blame Contribute Delete
1.39 kB
/* Shared boot-failure banner for the three read-only view bootstraps
* (boot-galaxy.js / boot-ladder.js / boot-ontology.js). A `resolveGraph()`
* rejection (missing/renamed saved model, malformed graph shape) previously
* propagated unhandled, leaving the page's static shell on screen with no
* explanation. This renders the specific, actionable error message the
* loaders already produce, instead of a silently blank page. */
import { esc } from './util.js';
export function showBootError(e) {
const msg = esc((e && e.message) || String(e));
const el = document.createElement('div');
el.setAttribute('role', 'alert');
el.style.cssText = [
'position:fixed', 'inset:0', 'z-index:99999',
'display:flex', 'align-items:center', 'justify-content:center',
'padding:24px', 'background:#0b0f14', 'color:#f2f4f8',
'font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif',
].join(';');
el.innerHTML = `<div style="max-width:560px;text-align:center;">
<div style="font-size:28px;margin-bottom:12px;">⚠️</div>
<div style="font-weight:600;margin-bottom:8px;">This view couldn't load its model.</div>
<div style="opacity:.85;">${msg}</div>
</div>`;
document.body.innerHTML = '';
document.body.appendChild(el);
// still surface it to the console/devtools for anyone debugging further
console.error(e);
}