Surface all errors: wrap event handlers in try/catch with console.error

- domAddListener wraps callbacks so exceptions always log to console
- Add "sx:route trying <url>" log before tryClientRoute call
- Remove redundant bind-event fired log (replaced with route-specific logs)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 21:53:54 +00:00
parent 70cf501c49
commit 3d191099e0
3 changed files with 10 additions and 6 deletions

View File

@@ -2514,7 +2514,9 @@ PLATFORM_ORCHESTRATION_JS = """
if (opts && !isNil(opts)) {
if (opts.once || opts["once"]) o.once = true;
}
el.addEventListener(event, fn, o);
el.addEventListener(event, function(e) {
try { fn(e); } catch (err) { console.error("[sx-ref] event handler error:", event, err); }
}, o);
}
// --- Validation ---