[BUG] main module evaluates to DeferredFunctionCall #4615
Labels
bug
issue confirmed as bug
needs XQSuite test
XQSuite test required to reproduce
xquery
issue is related to xquery implementation
Describe the bug
Consider a main module returning the value of a function call. The module is called from the controller.xq providing it an HTML payload (POST request).
If this main module is called first - returning an expected value - it will, when called with parameters that will raise an expected error, evaluate to a DeferredFunctionCall instead of catching the XPathException.
Adding a return type to the function declaration fixes the issue.
Expected behavior
Whenever an error is raised inside a function the expression will not evaluate to any value of any type but the error is raised.
To Reproduce
npm install
npm test
templates:process
(https://github.com/eXist-db/templating/blob/7cbb1d0d907608ccd77268baaf02db3a84f185fd/content/templates.xqm#L164)npm test
againnpm run test:mocha
Running this in a debuggable exist instance reveals that the error is not thrown but a DeferredFunctionCall is returned instead.
When exist tries to handle the returned value it fails to do so.
Context (please always complete the following information):
Additional context
conf.xml
? noneThe text was updated successfully, but these errors were encountered: