<?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>17643</bug_id>
          
          <creation_ts>2012-06-28 22:22:25 +0000</creation_ts>
          <short_desc>What should transaction.error be set to if a error handler throws an exception</short_desc>
          <delta_ts>2012-07-15 09:20:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>Indexed Database API</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="Jonas Sicking (Not reading bugmail)">jonas</reporter>
          <assigned_to name="This bug has no owner yet - up for the taking">dave.null</assigned_to>
          <cc>mike</cc>
    
    <cc>odinho</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>69516</commentid>
    <comment_count>0</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-06-28 22:22:25 +0000</bug_when>
    <thetext>The most basic question is, what should happen in the following scenario:

objectStore.add(&quot;value&quot;, 1); // succeeds
req = objectStore.add(&quot;value&quot;, 1); // will fail due to key collision
req.onerror = function(e) {
  throw;
}

This should obviously abort the transaction, but should transaction.error.name return &quot;ConstraintError&quot; or &quot;AbortError&quot;.

I don&apos;t have a strong opinion.

It sort of feels like the exception does override normal behavior, so we should set it to &quot;AbortError&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69517</commentid>
    <comment_count>1</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-06-28 22:23:19 +0000</bug_when>
    <thetext>A slightly less ambiguous case is

objectStore.add(&quot;value&quot;, 1); // succeeds
req = objectStore.add(&quot;value&quot;, 1); // will fail due to key collision
req.onerror = function(e) {
  e.preventDefault();
  throw;
}


Here it seems more clear that setting transaction.error to a &quot;AbortError&quot; is the right thing to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69518</commentid>
    <comment_count>2</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-06-28 22:43:07 +0000</bug_when>
    <thetext>One way to look at it is that for a normal function call, an exception overrides any return values.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69598</commentid>
    <comment_count>3</comment_count>
    <who name="Odin Hørthe Omdal">odinho</who>
    <bug_when>2012-07-03 16:24:15 +0000</bug_when>
    <thetext>If I was writing a test for that, I&apos;d check for AbortError. So guess I vote for that.


(The exception inside a handler has consequences stuff always felt a bit weird, tho ;-) )</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70010</commentid>
    <comment_count>4</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-07-15 09:20:58 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/IndexedDB/rev/aab14b0951ca</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>