Lists Home |
Date Index |
> If you have any constructive suggestions as to what kind of error-handling facility would keep your face straight, I'm sure the WG will be interested in hearing it. Note that XSLT also has problems in this area: the inability of applications to deal with errors from the document() function is a perennial user complaint.
Warning: this is by no means a response crafted with serious knowledge of XQuery as it is.
I think the solution to this is in declarative rules. It will be easier for me to express it in terms of XSLT, which I know well. 4Suite has a bunch of XSLT extensions that can do things such as add XML documents and RDF starements to the repository, among many other things. In order to deal with errors such as access control failures and such things, we are considering adding special XSLT templates: error templates. Error information would be generated in a specific XML form, and the user would be able to use the match parameter to specify which error template handles which errors. Ad to how to mark error templates: modes with a certain reserved namespace is the current thinking. So, for example:
Try it out
It's all good.
<xsl:template match='Exception/Description[. contains("ACL")]' mode="err:template">
It ain't all good
<xsl:text>Error from back end: </xsl:text><xsl:value-of select="Exception/Description"/> code: <xsl:value-of select="Exception/@code"/>
I know this could be problematic as a general solution for XSLT because of the sensible idea not to constrain order-of-execution. In 4Suite, we have additional semantics that make order of execution within XSLT known: which is fine and perfectly conformant, but would probably prevent easily plugging in other XSLT processors as replacements for server-side processing.
I've never liked the structured, hierarchical exception model of C++/Java (and even Python, though you have more flexibility with Python, of course). I actually prefer what amounts to BASIC's ON ERROR GOTO, as long as it's couched in a fairly rich rules language.
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Track chair, XML/Web Services One Boston: http://www.xmlconference.com/
The many heads of XML modeling - http://adtmag.com/article.asp?id=6393
Will XML live up to its promise? - http://www-106.ibm.com/developerworks/xml/library/x-think11.html