fix(js): isolate startup binding failures

Keep the public runtime API available and report state, binding, and SSE startup errors independently so one startup failure cannot hide the runtime object or other roots.

req: runtime/002
This commit is contained in:
slhx agent
2026-06-05 20:34:08 +02:00
parent 4b83169207
commit 736f9f3c7e
2 changed files with 12 additions and 2 deletions
+9 -1
View File
@@ -793,10 +793,18 @@
roots().forEach((root) => {
try {
bootstrapState(root);
} catch (error) {
emit(root, "hemx:state-error", String(error));
}
try {
bindRoot(root);
} catch (error) {
emit(root, "hemx:bind-error", String(error));
}
try {
bindSse(root);
} catch (error) {
emit(root, "hemx:error", String(error));
emit(root, "hemx:sse-error", String(error));
}
});
try {
+3 -1
View File
@@ -11,7 +11,9 @@ fn runtime_exposes_debug_api_before_startup_side_effects() {
.expect("runtime starts after declaration");
assert!(api < start);
assert!(source.contains("try {\n bootstrapState(root);"));
assert!(source.contains("emit(root, \"hemx:error\", String(error));"));
assert!(source.contains("emit(root, \"hemx:state-error\", String(error));"));
assert!(source.contains("try {\n bindRoot(root);"));
assert!(source.contains("emit(root, \"hemx:bind-error\", String(error));"));
}
#[test]