mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 01:02:01 +03:00
Fix: Surface evaluation failures to avoid hiding bugs
Modifies `src/engine/index.ts` to surface unhandled evaluation errors. Previously, generic exceptions were completely silenced, masking bugs or `BigInt` conversion errors. Now, `EvalError` exceptions correctly populate the `lineError` so they are surfaced in the UI without crashing the sheet. Other generic runtime errors are also captured and output to the UI and console. `XRefError` exceptions are preserved and behave identically as before. Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
parent
f5b1fc038b
commit
1872c4b159
1 changed files with 5 additions and 1 deletions
|
|
@ -138,7 +138,11 @@ export class SumEngine {
|
||||||
// including extension bugs and BigInt conversion errors
|
// including extension bugs and BigInt conversion errors
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof XRefError) lineError = e.message;
|
if (e instanceof XRefError) lineError = e.message;
|
||||||
else if (!(e instanceof EvalError)) console.warn("evaluate failed:", e);
|
else if (e instanceof EvalError) lineError = e.message;
|
||||||
|
else {
|
||||||
|
console.warn("evaluate failed:", e);
|
||||||
|
lineError = e instanceof Error ? e.message : String(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