xquery:eval error propagation

Tuesday, 18 April 2017 · 3 messages
IB
Iwan Briquemont18 Apr 2017 11:28 #
Hello, I use xquery:eval to evaluate some user provided queries. It works well but when there is an error the true origin of the error is hidden, as it will give the file and line of the xquery:eval call. Is there any way to pass the origin of the error through the xquery:eval? I guess the best would be to keep both origins. My workaround is to do a try/catch inside the evaluated query and wrap the result with the error variables. It's a bit cumbersome and does not work for static errors. Thank you, Iwan
CG
Christian Grün18 Apr 2017 12:15 #
Dear Iwan, Thanks for the feature proposal. As you may have seen, the xquery:parse function provides a 'pass' option, which can be used to pass on the original error info [1]. I have now added this option to xquery:eval [2], and to all other functions that support the same options. Feedback on the latest stable snapshot is welcome [3]. Cheers, Christian [1] http://docs.basex.org/wiki/XQuery_Module#xquery:parse [2] http://docs.basex.org/wiki/XQuery_Module#xquery:eval [3] http://files.basex.org/releases/latest/
Quoted text · Iwan Briquemont · 18 lines
On Tue, Apr 18, 2017 at 11:28 AM, Iwan Briquemont <tracnar at gmail.com> wrote: > Hello, > > I use xquery:eval to evaluate some user provided queries. > > It works well but when there is an error the true origin of the error > is hidden, as it will give the file and line of the xquery:eval call. > > Is there any way to pass the origin of the error through the > xquery:eval? > I guess the best would be to keep both origins. > > My workaround is to do a try/catch inside the evaluated query and wrap > the result with the error variables. It's a bit cumbersome and does not > work for static errors. > > Thank you, > Iwan
IB
Iwan Briquemont18 Apr 2017 12:22 #
Dear Christian, Perfect! I had not seen that option yet. Thank you, Iwan Le 18 avr. 2017 12:16, "Christian Grün" <christian.gruen at gmail.com> a écrit : Dear Iwan, Thanks for the feature proposal. As you may have seen, the xquery:parse function provides a 'pass' option, which can be used to pass on the original error info [1]. I have now added this option to xquery:eval [2], and to all other functions that support the same options. Feedback on the latest stable snapshot is welcome [3]. Cheers, Christian [1] http://docs.basex.org/wiki/XQuery_Module#xquery:parse [2] http://docs.basex.org/wiki/XQuery_Module#xquery:eval [3] http://files.basex.org/releases/latest/
Quoted text · Iwan Briquemont · 18 lines
On Tue, Apr 18, 2017 at 11:28 AM, Iwan Briquemont <tracnar at gmail.com> wrote: > Hello, > > I use xquery:eval to evaluate some user provided queries. > > It works well but when there is an error the true origin of the error > is hidden, as it will give the file and line of the xquery:eval call. > > Is there any way to pass the origin of the error through the > xquery:eval? > I guess the best would be to keep both origins. > > My workaround is to do a try/catch inside the evaluated query and wrap > the result with the error variables. It's a bit cumbersome and does not > work for static errors. > > Thank you, > Iwan

⚡Generated with XQuery