Skip to content

HF-131 (6/7): thrown exceptions name the cell (issue #444) - #1766

Open
marcin-kordas-hoc wants to merge 10 commits into
fix/hf-131-rootless-originfrom
fix/hf-131-issue-444-addresses
Open

marcin-kordas-hoc wants to merge 10 commits into
fix/hf-131-rootless-originfrom
fix/hf-131-issue-444-addresses

Conversation

@marcin-kordas-hoc

@marcin-kordas-hoc marcin-kordas-hoc commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

What and why

Stacked on #1765. Closes #444: reading
a formula cell's value before it has been computed threw a plain Error('Value of the formula cell is not computed.') / Error('Array not computed yet.') — no way to trace which cell caused it.

Adds CellValueNotComputedError, a named, exported error class carrying the cell's address:

export class CellValueNotComputedError extends Error {
  constructor(public readonly address: SimpleCellAddress) {
    super(`Value of the formula cell (sheet = ${address.sheet}, row = ${address.row}, col = ${address.col}) is not computed.`)
  }
}

Replaces both throw sites (ScalarFormulaVertex.getCellValue, ArrayFormulaVertex.getCellValue).
Exported from src/index.ts, both as a named export and on the HyperFormula static namespace,
alongside CellError/DetailedCellError.

Verified

  • npx tsc --noEmit — clean
  • npx eslint src/ — 0 errors
  • New test file, 4 cases across both vertex types
  • Full private test suite reproduced against this branch's tip — no regressions beyond the same
    pre-existing branch-pinning mismatch as the rest of this stack

Stack

6 of 7 — stacked on #1765. Next: docs/hf-131-types-of-errors.

🤖 Generated with Claude Code


Note

Low Risk
Narrow change to error typing at two internal throw sites plus a new public export; callers that relied on exact generic Error message strings may need to catch CellValueNotComputedError instead.

Overview
Reading a formula cell before evaluation used to throw anonymous plain Error messages (Value of the formula cell is not computed. / Array not computed yet.), so callers could not identify which cell failed.

This PR introduces CellValueNotComputedError with a public address field (SimpleCellAddress) and a message that includes sheet, row, and col. ScalarFormulaVertex.getCellValue and ArrayFormulaVertex.getCellValue now throw this type instead of generic errors.

The class is exported from the package entry (named export and HyperFormula.CellValueNotComputedError static), and the unreleased CHANGELOG documents the behavior change for issue #444.

Reviewed by Cursor Bugbot for commit 1879bbb. Bugbot is set up for automated code reviews on this repo. Configure here.

Reading a formula cell's value before it has been computed used to throw a
bare Error with no way to identify which cell caused it — the literal
complaint in issue #444, open since 2020-07-07. Both vertex classes that can
throw this (ScalarFormulaVertex and ArrayFormulaVertex, sibling classes in
the same file) had the identical defect.

CellValueNotComputedError carries the address as a field rather than only in
prose, and is re-exported from the package (import block, HyperFormulaNS
static, and the bottom export block in src/index.ts) so a consumer can catch
it by type, not just by parsing the message.

The message itself interpolates numeric sheet/row/col rather than A1-style
notation: neither vertex class has access to the sheetIndexMapping that
A1-conversion requires, so the field is the deliverable, not the prose.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@qunabu

qunabu commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit da37522. Configure here.

Comment thread CHANGELOG.md
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 10, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
hyperformula-docs 1879bbb Commit Preview URL

Branch Preview URL
Sep 15 2026, 08:03 AM

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

Performance comparison of head (1879bbb) vs base (e2ced02)

                                     testName |    base |    head |  change
---------------------------------------------------------------------------
                                      Sheet A |  492.38 |  495.18 |  +0.57%
                                      Sheet B |  155.56 |  156.49 |  +0.60%
                                      Sheet T |  139.44 |  136.91 |  -1.81%
                                Column ranges |   466.2 |  468.06 |  +0.40%
                                Sorted lookup | 14051.8 | 13806.5 |  -1.75%
Sheet A:  change value, add/remove row/column |   14.41 |   17.32 | +20.19%
 Sheet B: change value, add/remove row/column |  131.02 |  157.02 | +19.84%
                   Column ranges - add column |  145.92 |  159.83 |  +9.53%
                Column ranges - without batch |  447.95 |  465.54 |  +3.93%
                        Column ranges - batch |  112.34 |   118.1 |  +5.13%

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.45%. Comparing base (e2ced02) to head (1879bbb).

Additional details and impacted files

Impacted file tree graph

@@                      Coverage Diff                       @@
##           fix/hf-131-rootless-origin    #1766      +/-   ##
==============================================================
+ Coverage                       97.43%   97.45%   +0.01%     
==============================================================
  Files                             195      195              
  Lines                           15862    15868       +6     
  Branches                         3500     3500              
==============================================================
+ Hits                            15455    15464       +9     
+ Misses                            399      396       -3     
  Partials                            8        8              
Files with missing lines Coverage Δ
src/DependencyGraph/FormulaVertex.ts 86.71% <100.00%> (+2.46%) ⬆️
src/errors.ts 100.00% <100.00%> (ø)
src/index.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Tobiadefami Tobiadefami left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks good.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants