Error handling
Wednesday, 26 March 2014 · 3 messages · last reply 26 May 2014
ML
Marco Lettere26 Mar 2014 11:09 #
Hello all,
the error interception functions are pretty useful. My "feature request" here is whether it could be possible to overcome:
"XQuery runtime errors can be processed via /error annotations/. A single argument must be supplied, which represents the QName of the error to be caught. A wildcard |*| may be specified to catch all possible errors. A function can only have a single error annotation:"
It could be useful to have at least a second level of wildcards on the QName prefix in order to be able to differentiate behaviours according to categories of errors.
|%rest:error||(||"ns1:*"||)|
A more fine grained filtering (i.e. comma separated list of exception codes) could also be useful but since I don't understand the difficulty of building this into the code I won't ask too much.
The only alternative I see at the moment is a single function with a switch or a lot of replicated functions.
What is your opinion on this?
Thanks and regards,
Marco.
CG
Christian Grün27 Mar 2014 14:11 #
Hi Marco,
adding wildcard support to the %restxq:error annotation shouldn't be that much effort. We may need to clarify, however, what is going to happen if more than one candidate is found for an error message. I've added an issue [1]
Christian
[1] https://github.com/BaseXdb/basex/issues/915
Quoted text · Marco Lettere · 31 lines
On Wed, Mar 26, 2014 at 11:09 AM, Marco Lettere <m.lettere at gmail.com> wrote: > Hello all, > the error interception functions are pretty useful. My "feature request" > here is whether it could be possible to overcome: > > "XQuery runtime errors can be processed via error annotations. A single > argument must be supplied, which represents the QName of the error to be > caught. A wildcard * may be specified to catch all possible errors. A > function can only have a single error annotation:" > > It could be useful to have at least a second level of wildcards on the QName > prefix in order to be able to differentiate behaviours according to > categories of errors. > > %rest:error("ns1:*") > > A more fine grained filtering (i.e. comma separated list of exception codes) > could also be useful but since I don't understand the difficulty of building > this into the code I won't ask too much. > The only alternative I see at the moment is a single function with a switch > or a lot of replicated functions. > What is your opinion on this? > > Thanks and regards, > Marco. > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CG
And another update (feeling like X-Mas ? ;)...
http://docs.basex.org/wiki/RESTXQ#XQuery_Errors
http://files.basex.org/releases/latest/
Quoted text · Marco Lettere · 31 lines
On Wed, Mar 26, 2014 at 11:09 AM, Marco Lettere <m.lettere at gmail.com> wrote: > Hello all, > the error interception functions are pretty useful. My "feature request" > here is whether it could be possible to overcome: > > "XQuery runtime errors can be processed via error annotations. A single > argument must be supplied, which represents the QName of the error to be > caught. A wildcard * may be specified to catch all possible errors. A > function can only have a single error annotation:" > > It could be useful to have at least a second level of wildcards on the QName > prefix in order to be able to differentiate behaviours according to > categories of errors. > > %rest:error("ns1:*") > > A more fine grained filtering (i.e. comma separated list of exception codes) > could also be useful but since I don't understand the difficulty of building > this into the code I won't ask too much. > The only alternative I see at the moment is a single function with a switch > or a lot of replicated functions. > What is your opinion on this? > > Thanks and regards, > Marco. > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery