Add console logging for client-side routing decisions

tryClientRoute now logs why it falls through: has-data, no content,
eval failed, or #main-panel not found. tryEvalContent logs the actual
error on catch. Added logWarn platform function (console.warn).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 20:43:27 +00:00
parent f70861c175
commit 2d5096be6c
3 changed files with 19 additions and 8 deletions

View File

@@ -497,6 +497,7 @@ class JSEmitter:
"store-env-attr": "storeEnvAttr",
"to-kebab": "toKebab",
"log-info": "logInfo",
"log-warn": "logWarn",
"log-parse-error": "logParseError",
"parse-and-load-style-dict": "parseAndLoadStyleDict",
"_page-routes": "_pageRoutes",
@@ -2625,6 +2626,7 @@ PLATFORM_ORCHESTRATION_JS = """
}
return sxRenderWithEnv(source, merged);
} catch (e) {
console.warn("sx:route eval error", e);
return NIL;
}
}
@@ -2974,6 +2976,10 @@ PLATFORM_BOOT_JS = """
if (typeof console !== "undefined") console.log("[sx-ref] " + msg);
}
function logWarn(msg) {
if (typeof console !== "undefined") console.warn("[sx-ref] " + msg);
}
function logParseError(label, text, err) {
if (typeof console === "undefined") return;
var msg = err && err.message ? err.message : String(err);