Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] main module evaluates to DeferredFunctionCall #4615

Open
line-o opened this issue Nov 14, 2022 · 0 comments
Open

[BUG] main module evaluates to DeferredFunctionCall #4615

line-o opened this issue Nov 14, 2022 · 0 comments
Labels
bug issue confirmed as bug needs XQSuite test XQSuite test required to reproduce xquery issue is related to xquery implementation

Comments

@line-o
Copy link
Member

line-o commented Nov 14, 2022

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

  1. checkout Next major version templating#17
  2. run npm install
  3. run npm test
  4. all tests should pass
  5. remove the return type from templates:process (https://github.com/eXist-db/templating/blob/7cbb1d0d907608ccd77268baaf02db3a84f185fd/content/templates.xqm#L164)
  6. run npm test again
  7. one test-case testing for an error fails now because exist handles the requests differently: parameter start is out of bounds(!)
  8. re-run the mocha testsuite without updating the library npm run test:mocha
  9. three test-cases fail (all with the parameter start is out of bounds problem)

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):

  • OS: macOS 12.6
  • eXist-db version: 6.1.0-SNAPSHOT
  • Java Version 1.8.0_352-b08

Additional context

  • How is eXist-db installed? built from source 6723ed9
  • Any custom changes in e.g. conf.xml? none
@line-o line-o added bug issue confirmed as bug xquery issue is related to xquery implementation needs XQSuite test XQSuite test required to reproduce labels Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug needs XQSuite test XQSuite test required to reproduce xquery issue is related to xquery implementation
Projects
None yet
Development

No branches or pull requests

1 participant