How to get stack trace from an Query Exception?

Wednesday, 12 July 2023 · 2 messages · last reply 13 Jul 2023
EK
Eliot Kimber12 Jul 2023 22:46 #
The docs for Try/Catch in in the XQuery_3.0 page say: · $err:additional: error stack trace However, in my testing, this only returns the place where the error was thrown, not the complete stack trace as is shown e.g., in a web app when an exception is thrown. Is it possible to get the stack trace in XQuery? I didn’t find anything searching on the BaseX-supplied DBA app. Thanks, E. _____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.com<https://www.servicenow.com> LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow>
CG
Christian Grün13 Jul 2023 17:24 #
Hi Eliot, Thanks for the pointer that led me to update the documentation: We returned “something like a stack trace” in a previous version of BaseX, but the result was often misleading: Functions are inlined and simplified at compile time, and it’s often not possible to return a stack trace representation at runtime that reflects function calls of the original query. This is why we eventually dropped this information. During development, though, it can be helpful to assign 0 to the INLINELIMIT option. This way, function inlining is disabled, and the returned stack traces (without try/catch) make more sense. However, queries without inlining may run much slower than standard ones. Hope this helps, Christian
Quoted text · Eliot Kimber · 38 lines
On Wed, Jul 12, 2023 at 10:46 PM Eliot Kimber <eliot.kimber at servicenow.com> wrote: > > The docs for Try/Catch in in the XQuery_3.0 page say: > > > > · $err:additional: error stack trace > > > > However, in my testing, this only returns the place where the error was thrown, not the complete stack trace as is shown e.g., in a web app when an exception is thrown. > > > > Is it possible to get the stack trace in XQuery? I didn’t find anything searching on the BaseX-supplied DBA app. > > > > Thanks, > > > > E. > > _____________________________________________ > > Eliot Kimber > > Sr Staff Content Engineer > > O: 512 554 9368 > > M: 512 554 9368 > > servicenow.com > > LinkedIn | Twitter | YouTube | Facebook

⚡Generated with XQuery