Skip to content

Commit

Permalink
XPath.evaluate() throws a TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Feb 3, 2025
1 parent 8920deb commit 6241a93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<body>
<release version="4.10.0" date="February xx, 2025" description="Bugfixes">
<action type="fix" dev="rbri">
XPath.evaluate() throws a TypeError.
</action>
<action type="fix" dev="rbri">
Document - several fixes to throw the correct error.
</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public XPathResult evaluate(final String expression, final Object contextNodeObj
try {
// contextNodeObj can be either a node or an array with the node as the first element.
if (!(contextNodeObj instanceof Node)) {
throw JavaScriptEngine.reportRuntimeError("Illegal value for parameter 'context'");
throw JavaScriptEngine.typeError("Illegal value for parameter 'context'");
}

final Node contextNode = (Node) contextNodeObj;
Expand All @@ -105,7 +105,7 @@ else if (resolver instanceof NativeFunction) {
return xPathResult;
}
catch (final Exception e) {
throw JavaScriptEngine.reportRuntimeError("Failed to execute 'evaluate': " + e.getMessage());
throw JavaScriptEngine.typeError("Failed to execute 'evaluate': " + e.getMessage());
}
}

Expand Down

0 comments on commit 6241a93

Please sign in to comment.