mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-10 19:11:58 +03:00
surface non-EvalError exceptions in evaluation engine
This commit is contained in:
parent
62ef8cc8cd
commit
54c9cc63b0
1 changed files with 11 additions and 4 deletions
|
|
@ -134,11 +134,18 @@ export class SumEngine {
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
value = evaluate(parsed.expr, ctx);
|
value = evaluate(parsed.expr, ctx);
|
||||||
// a line without a result beats a dead sheet — swallow everything,
|
// a line without a result beats a dead sheet.
|
||||||
// including extension bugs and BigInt conversion errors
|
// surface unexpected bugs so the user knows why it failed
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof XRefError) lineError = e.message;
|
if (e instanceof XRefError) {
|
||||||
else if (!(e instanceof EvalError)) console.warn("evaluate failed:", e);
|
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;
|
value = null;
|
||||||
}
|
}
|
||||||
if (value?.kind === "quantity" && !value.value.isFinite()) value = null;
|
if (value?.kind === "quantity" && !value.value.isFinite()) value = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue