Skip to content

Conversation

@bwrrp
Copy link
Member

@bwrrp bwrrp commented Mar 19, 2025

Fixes #672

@bundlemon
Copy link

bundlemon bot commented Mar 19, 2025

BundleMon

Unchanged files (2)
Status Path Size Limits
fontoxpath.esm.js
78.72KB -
fontoxpath.js
78.61KB -

No change in files bundle size

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link
Contributor

@DrRataplan DrRataplan left a comment

Choose a reason for hiding this comment

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

Kind of missing a unit test here. Can you add one?

@coveralls
Copy link

coveralls commented Mar 19, 2025

Coverage Status

coverage: 91.576%. remained the same
when pulling 572aa37 on evaluate-error-element-expressions
into c5f6dd6 on master.

@bwrrp
Copy link
Member Author

bwrrp commented Mar 19, 2025

Kind of missing a unit test here. Can you add one?

Added one. Turns out this also only triggered if the evaluated expression was generated with stack traces on, as otherwise parseAndRethrowError would just hit its early return and ignore the selector argument.

@DrRataplan
Copy link
Contributor

Oof. Hope at least the error is now kind-of readable?

@bwrrp
Copy link
Member Author

bwrrp commented Mar 19, 2025

Yep, full error thrown here is now:

1: fontoxpath:evaluate($expr, map{ 'n': 1.2 })
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Inner error:
1: format-integer($n,"A")
   ^^^^^^^^^^^^^^^^^^^^^^
      
Error: XPTY0004 Unable to cast argument of type xs:decimal to type xs:integer? while calling format-integer
  at <functionCallExpr (format-integer)>:1:1 - 1:23
  at <functionCallExpr (fontoxpath:evaluate)>:1:1 - 1:44

Without the fix we get:

1: fontoxpath:evaluate($expr, map{ 'n': 1.2 })
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
  at <functionCallExpr (fontoxpath:evaluate)>:1:1 - 1:44

@bwrrp bwrrp force-pushed the evaluate-error-element-expressions branch from cbf7d2f to 572aa37 Compare March 24, 2025 09:41
@bwrrp bwrrp closed this Mar 24, 2025
@bwrrp bwrrp merged commit 572aa37 into master Mar 24, 2025
17 checks passed
@bwrrp bwrrp deleted the evaluate-error-element-expressions branch March 24, 2025 09:52
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.

Primary error hidden if fontoxpath:evaluate is applied to a precompiled expression that throws

5 participants