feat(web): copyable on-page banner for renderer errors (#414)

wgpu/naga report pipeline and shader failures through the log facade,
then leave the canvas empty - with no logger installed on wasm the
message was lost, so a broken GPU path looked like "draws nothing" with
a clean console. Install a web logger that mirrors Error-level records
to the browser console and into a fixed DOM overlay with selectable
text, a Copy button and repeat-collapsing; panics land in the same
banner via a chained hook. Windows Chrome/Edge reporters can now paste
the exact ANGLE/D3D11 error instead of a screenshot of a blank canvas.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Fable 5 committed 2026-07-21 16:43:35 +03:00
1 parent 77535f7c68
commit 427db6cd17
4 files changed
+131

No files matched your search

+9
View File
@@ -109,6 +109,10 @@ ureq = { version = "3", default-features = false, features = ["rustls"] }
# Web gets the dependency-free manifest/ribbon contract only (no plugin host).
ocs_plugin_api = { path = "crates/ocs_plugin_api" }
console_error_panic_hook = "0.1"
# Log facade (already in the tree via wgpu/iced): lets the web build install a
# logger that mirrors wgpu/naga pipeline errors into a copyable on-page banner —
# a WebGL2 pipeline that fails to build otherwise just leaves the canvas empty.
log = "0.4"
# ahash (via acadrust) pulls getrandom 0.3, which needs the `wasm_js` backend
# enabled to support wasm32-unknown-unknown (plus the matching rustflag in
# .cargo/config.toml).
@@ -132,6 +136,11 @@ web-sys = { version = "0.3", features = [
# Async clipboard read for paste into the text/MText editors (iced's own
# clipboard read is a no-op on the web).
"Clipboard",
# Error banner (web_diag): forward wgpu/naga errors to the browser console
# and inject a copyable DOM overlay (document.body → append_child).
"console",
"Node",
"HtmlElement",
] }
# Browsers without WebGPU (e.g. Firefox by default) need wgpu's WebGL2 backend;
# `webgl` enables it. `fira-sans` embeds the default UI font — the web has no