fix(journal): surface variable eval errors
Collect and report failed declarations, failed tag modifier expressions, and circular dependencies instead of swallowing them. Diagnostics are deduped, logged with key/expression context, cleared on re-init, and exposed through useJournalCompletions and the VariableView warning banner. A bad declaration no longer aborts the rest of a cascade. Reject malformed numeric literals in the tokenizer so inputs like "1.2.3" throw instead of being truncated by parseFloat.
This commit is contained in:
@@ -17,6 +17,9 @@ export const VariableView: Component = () => {
|
||||
|
||||
const values = createMemo(() => stream.variables);
|
||||
|
||||
/** Runtime engine diagnostics (bad declarations / modifiers). */
|
||||
const diagnostics = createMemo(() => comp.diagnostics());
|
||||
|
||||
/** Flat list of all variables */
|
||||
const items = createMemo(() => {
|
||||
const vars = values();
|
||||
@@ -32,6 +35,20 @@ export const VariableView: Component = () => {
|
||||
|
||||
return (
|
||||
<div class="h-full overflow-y-auto bg-gray-50">
|
||||
<Show when={diagnostics().length > 0}>
|
||||
<div class="border-b border-amber-200 bg-amber-50 px-3 py-2">
|
||||
<div class="text-xs font-semibold text-amber-800 mb-1">
|
||||
变量求值有 {diagnostics().length} 个问题
|
||||
</div>
|
||||
<ul class="space-y-1">
|
||||
<For each={diagnostics()}>
|
||||
{(d) => (
|
||||
<li class="text-xs text-amber-700 font-mono break-all">{d.message}</li>
|
||||
)}
|
||||
</For>
|
||||
</ul>
|
||||
</div>
|
||||
</Show>
|
||||
<Show
|
||||
when={hasAnyData()}
|
||||
fallback={
|
||||
|
||||
Reference in New Issue
Block a user