Closed Bug 580839 Opened 14 years ago Closed 13 years ago

Satchel can throw the wrong exception on failures

Categories

(Toolkit :: Form Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla7

People

(Reporter: Dolske, Assigned: jaws)

Details

(Whiteboard: [good first bug])

Attachments

(1 file)

From bug 552828 comment 12:

> > >         } catch (e) {
> > >             this.log("getExistingEntryID failed: " + e);
> > >             throw e;
> > >         } finally {
> > >-            stmt.reset();
> > >+            if (stmt)
> > >+                stmt.reset();
> > >         }
> > 
> > What's this change for?
> 
> dbCreateStatement managed to return null or throw once for me and I saw an
> error message, so I added the check.

Indeed, if an exception occurs in the |finally|, callers see that instead of the intended |throw e| from the |catch|. We should fix all the cases in satchel where this pattern exists (and in pwmgr, if it's there?) to test |stmt| before trying to reset it.

This won't be a functional change, because there shouldn't be any callers that depend on specific exceptions (afaik), but it would be helpful for debugging.
Whiteboard: [good first bug]
I'll take this bug
Assignee: nobody → jwein
Status: NEW → ASSIGNED
Fix for bug 580839. Switched the finally blocks to check for a truthy |stmt| before invoking a member function on it.
Attachment #539881 - Flags: review?(dolske)
(In reply to comment #0)
> Indeed, if an exception occurs in the |finally|, callers see that instead of
> the intended |throw e| from the |catch|. We should fix all the cases in
> satchel where this pattern exists (and in pwmgr, if it's there?) to test
> |stmt| before trying to reset it.

Filed bug 665217 for pwmgr.
Comment on attachment 539881 [details] [diff] [review]
Patch for bug 580839

Looks good! woo!
Attachment #539881 - Flags: review?(dolske) → review+
Push http://hg.mozilla.org/mozilla-central/rev/1d962ae5a4b6
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Can anyone please provide some guidelines to verify this fix?

Thank you!
(In reply to Mihaela Velimiroviciu from comment #6)
> Can anyone please provide some guidelines to verify this fix?
> 
> Thank you!

Not really needed. These errors are very hard to hit and have no user facing result.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: