Hi Christian,

So I already forgot about the first few lines of the message (I always cut them away). What I miss is the rest, the stack trace, the list of calls that got me to that line:

I need something like
`Stopped at { $err:module }, { $err:line-number }/{ $err:column-number }:
{ $err:description }
{ $err:stack-trace }`

I create XML and JSON according to an RFC and I want to be able to have the trace there. I already use { $err:module }, { $err:line-number }, { $err:column-number } and { $err:description } E. g:
<problem xmlns="urn:ietf:rfc:7807">
<type>https://tools.ietf.org/html/rfc7807/tests</type>
  <title>_:an-error: testError Test1 Test2 Test3</title>
  <detail> Test1 Test2 Test3</detail>
<instance>https://tools.ietf.org/html/rfc7807/tests/an-error</instance>
  <status>500</status>
  <trace>/app/tests/api-problem-rest-test.xqm, 38/10
- /app/tests/api-problem-rest-test.xqm, 34/16
- /app/tests/api-problem-rest-test.xqm, 30/15
- /app/tests/api-problem-rest-test.xqm, 26/15
- /app/tests/api-problem-rest-test.xqm, 21/58
- /app/api-problem/api-problem.xqm, 41/26
  </trace>
  <took>3.55</took>
</problem>

While in 10.7+ I only get

<problem xmlns="urn:ietf:rfc:7807">
  <type>https://tools.ietf.org/html/rfc7807/tests</type>
  <title>_:an-error: testError Test1 Test2 Test3</title>
  <detail> Test1 Test2 Test3</detail>
  <instance>https://tools.ietf.org/html/rfc7807/tests/an-error</instance>
  <status>500</status>
  <trace>/app/tests/api-problem-rest-test.xqm, 38/10</trace>
  <took>2.15</took>
</problem>


See https://github.com/acdh-oeaw/api-problem4restxq/blob/master/tests/api-problem-rest-test.xqm#L15-L23 for details.
There is a docker image using 10.6 for quick testing.
docker run --rm -it -p 5000:5000 ghcr.io/acdh-oeaw/api-problem4restxq vs
docker run --rm -it -p 5000:5000 ghcr.io/acdh-oeaw/api-problem4restxq:27f2a42
Look at to http://localhost:5000

Best regards
Omar

Am 12.01.2024 um 14:14 schrieb Christian Grün:
Hi Omar,

Thanks for your observation.

We have removed the BaseX-specific string output, as it was redundant. You should be able to reproduce the old output as follows (using the new XQuery 4 string template syntax):

`Stopped at { $err:module }, { $err:line-number }/{ $err:column-number }:
{ $err:description }`

As you’ve already discovered the responsible commit, you may have discovered the new XQuery 4 $err:map variable: It bundles all other error values into a single variable.

And @Martin Honnen thanks for mentioning fn:stack-trace. The function is still under discussion and might be dropped again: The specification gives processors much freedom in optimizing its expressions, so it’s hardly possible to define the function in a way that’s not completely implementation-defined.

Hope this helps,
Christian

--
Mag. Ing. Omar Siam
Austrian Center for Digital Humanities and Cultural Heritage
Österreichische Akademie der Wissenschaften | Austrian Academy of Sciences
Stellvertretende Behindertenvertrauensperson | Deputy representative for 
disabled persons
Bäckerstraße 13, 1010 Wien, Österreich | Vienna, Austria
T: +43 1 51581-7295
omar.s...@oeaw.ac.at  |www.oeaw.ac.at/acdh

Reply via email to