<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>29264</bug_id>
          
          <creation_ts>2015-11-06 10:48:43 +0000</creation_ts>
          <short_desc>[XQ31] XQuery err details as a map</short_desc>
          <delta_ts>2015-11-10 17:27:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XQuery 3.1</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andy Bunce">andybuncester</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>abel.braaksma</cc>
    
    <cc>christian.gruen</cc>
    
    <cc>mike</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>124110</commentid>
    <comment_count>0</comment_count>
    <who name="Andy Bunce">andybuncester</who>
    <bug_when>2015-11-06 10:48:43 +0000</bug_when>
    <thetext>Within the catch() of a try-catch expression [1] available various error details are made available as variables e.g. $err:code. 
As a XQuery developer I want to use common error logging/handling routines across an application or applications. 
It is tedious to pass all the error details into such a common function. 
Now maps are part of XQuery, I would find useful a function something like
  
declare function err:details() as map(*)

Within the catch expression it would return the value of

 map{
               &quot;code&quot;:$err:code,
               &quot;description&quot;:$err:description,
               &quot;value&quot;:$err:value,
               &quot;module&quot;:$err:module,
               &quot;line-number&quot;:$err:line-number,
                &quot;column-number&quot;:$err:column-number,
               &quot;additional&quot;:$err:additional 
               }

An example use would look like:

try{
   ...
}
catch * { 
   myerrorhandler( err:details() )
}

/Andy

[1]  http://www.w3.org/TR/xquery-31/#id-try-catch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124115</commentid>
    <comment_count>1</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-11-06 15:12:03 +0000</bug_when>
    <thetext>I like the idea. Maybe an additional variable ($err:details ?) could be added to the catch scope, which contains the map you proposed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124116</commentid>
    <comment_count>2</comment_count>
    <who name="Andy Bunce">andybuncester</who>
    <bug_when>2015-11-06 15:17:56 +0000</bug_when>
    <thetext>A variable would be fine for me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124117</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-11-06 15:29:34 +0000</bug_when>
    <thetext>Not denying that this is a good idea, but we&apos;re way past the time for putting things in to the spec just because they are good ideas.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124120</commentid>
    <comment_count>4</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2015-11-06 17:02:37 +0000</bug_when>
    <thetext>Note that at some point with XP30 maps were suggested and approved. Later they were dropped because maps were not ready for inclusion yet (this is why XSLT and XQuery have the same here, even XSLT has withstood the temptation to turn the errors into a map, notwithstanding positive support for it). 

Maps have now made it to XP31, whether that means you need an *extra* way of getting the data of an error, I don&apos;t know. If I had the chance, I&apos;d drop the error vars entirely, a scoped function like current-group() in XSLT but then current-error() with similar semantics sounds way better, but I&apos;m with Michael here, I believe we&apos;re past our window for new ideas...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124121</commentid>
    <comment_count>5</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2015-11-06 17:02:46 +0000</bug_when>
    <thetext>Note that at some point with XP30 maps were suggested and approved. Later they were dropped because maps were not ready for inclusion yet (this is why XSLT and XQuery have the same here, even XSLT has withstood the temptation to turn the errors into a map, notwithstanding positive support for it). 

Maps have now made it to XP31, whether that means you need an *extra* way of getting the data of an error, I don&apos;t know. If I had the chance, I&apos;d drop the error vars entirely, a scoped function like current-group() in XSLT but then current-error() with similar semantics sounds way better, but I&apos;m with Michael here, I believe we&apos;re past our window for new ideas...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124142</commentid>
    <comment_count>6</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2015-11-09 21:07:42 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #3)
&gt; Not denying that this is a good idea, but we&apos;re way past the time for
&gt; putting things in to the spec just because they are good ideas.

Agreed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124159</commentid>
    <comment_count>7</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2015-11-10 17:27:40 +0000</bug_when>
    <thetext>Good idea, too late in the game.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>