- From: <bugzilla@jessica.w3.org>
- Date: Fri, 25 May 2012 17:27:34 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17191
Summary: (Too?) magic try/catch syntax
Product: XPath / XQuery / XSLT
Version: Working drafts
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: XQuery 3.0
AssignedTo: jonathan.robie@gmail.com
ReportedBy: hannesbauer@yahoo.com
QAContact: public-qt-comments@w3.org
I'm wondering if it's still possible to change the current try/catch syntax of
XQuery 3.0?
Frankly, with all variables being magically assigned (afaik, something that
happens nowhere else in XQuery), it's pretty inconvenient to pass on all error
information to another function..
Current solution:
try {
123+'456'
} catch * {
local:handle-error($err:code, $err:description, $err:value, $err:module,
$err:line-number, $err:column-number }
}
Thus it would be great if
a) the error could be bound to a specific variable, and/or
b) all information could be represented as a single element
Resulting queries could look as follows:
Query:
declare function local:handle($error) { $error };
try { 123+'456' } catch *($e) { local:handle($e) }
Result (brave proposal):
<XPTY0004 xmlns="http://www.w3.org/2005/xqt-errors" line="4" column="5">
Typing error: ...
</XPTY0004>
As I'm probably throwing this in pretty late, maybe it is possible to extend
the existing draft without endangering the existing functionality; e.g. by
making the variable declaration optional, and adding yet another variable
($err:element?) that includes the values of most of the existing variables?
It's nice, however, that multiple error codes can be listed in one catch
expression.
Thanks for your attention,
HB
--
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Friday, 25 May 2012 17:27:50 UTC