🧹 [Code Health] Replace generic Error with specific EvalError in tests

🎯 What: Replaced `throw new Error("test error")` with `throw new EvalError("test error")` in the `sequence error recovery` test case within `src/engine/engine.test.ts`.

💡 Why: `EvalError` is the standard domain error used by the evaluation engine. Throwing a generic `Error` triggers a console warning in the error handling code (which treats it as an unexpected bug), whereas `EvalError` is correctly handled silently as expected evaluation failure, improving the clarity of what kind of error is being tested.

✅ Verification: Ran `npm run test src/engine/engine.test.ts` and the full test suite via `npm run test`, which all completed successfully.

✨ Result: More accurate test setup and adherence to the evaluation engine's specific error handling abstractions.

Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot] 2026-08-12 17:34:17 +00:00
parent 268ac9e81b
commit 5e49fa185a

View file

@ -218,7 +218,7 @@ describe("numeral systems", () => {
describe("variables and document context", () => { describe("variables and document context", () => {
it("sequence error recovery", () => { it("sequence error recovery", () => {
eng.addFunction({ id: "throw_err", phrases: "throw_err" }, () => { eng.addFunction({ id: "throw_err", phrases: "throw_err" }, () => {
throw new Error("test error"); throw new EvalError("test error");
}); });
expect(calc("throw_err(1) 2 hours")).toBe("2 h"); expect(calc("throw_err(1) 2 hours")).toBe("2 h");
}); });