surface non-EvalError exceptions in evaluation engine

This commit is contained in:
Horizontal42 2026-08-09 15:57:35 +03:00 • committed by GitHub
parent 62ef8cc8cd
commit 54c9cc63b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -134,11 +134,18 @@ export class SumEngine {
};
try {
value = evaluate(parsed.expr, ctx);
// a line without a result beats a dead sheet — swallow everything,
// including extension bugs and BigInt conversion errors
// a line without a result beats a dead sheet.
// surface unexpected bugs so the user knows why it failed
} catch (e) {
if (e instanceof XRefError) lineError = e.message;
else if (!(e instanceof EvalError)) console.warn("evaluate failed:", e);
if (e instanceof XRefError) {
lineError = e.message;
} else if (e instanceof EvalError) {
// Expected evaluation failure; remain silent
} else {
// Surface unexpected bugs/BigInt errors and log them
lineError = e instanceof Error ? e.message : String(e);
console.warn("evaluate failed:", e);
}
value = null;
}
if (value?.kind === "quantity" && !value.value.isFinite()) value = null;