Audit front-end code for unnecessary try/catch blocks

ASSIGNED
Assigned to

Status

Thunderbird
Mail Window Front End
ASSIGNED
10 years ago
10 years ago

People

(Reporter: Joey Minta, Assigned: Joey Minta)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

10 years ago
Created attachment 341786 [details] [diff] [review]
patch v1

There are a lot of places where large chunks of code are kept in try/catch blocks, and errors are either swallowed or dump()ed.  As a mac hacker, this can make errors easy to miss, and difficult to track down, because dump() does not end up in an easily viewable place. More importantly, these try/catch blocks can mask other errors, or hurt performance. This patch removes most of the obviously unncessary blocks.

This patch looks bigger than it actually is, since removing a try/catch almost always requires adjusting whitespace. I haven't yet figured out how to force hg to give me a -w patch.
Attachment #341786 - Flags: review?(philringnalda)
In mailWindowOverlay.js::MsgFilters - gDBView.hdrForFirstSelectedMessage throws NS_ERROR_UNEXPECTED if there's a folder selected, but no message selected (select an empty folder then Tools - Message Filters is the easiest way to repro).
As does the gDBView.URIForFirstSelectedMessage in msgMail3PaneWindow.js::GetLoadedMessage
Error: treeView.selection is null
Source File: chrome://messenger/content/msgMail3PaneWindow.js
Line: 1291
Comment on attachment 341786 [details] [diff] [review]
patch v1

Not going to be quite that easy.
Attachment #341786 - Flags: review?(philringnalda) → review-
(In reply to comment #0)
> This patch looks bigger than it actually is, since removing a try/catch almost
> always requires adjusting whitespace. I haven't yet figured out how to force hg
> to give me a -w patch.

hg diff -w is meant to work, but it seems it doesn't work for everyone. So, in your .hgrc file, to the [extensions] section add:

hgext.extdiff =

Then add a new section (if it isn't there already):

[extdiff]
cmd.diffw = diff
opts.diffw = -NprwU8

Use the options that you prefer the most. You'll then have a new command 'hg diffw'
You need to log in before you can comment on or make changes to this bug.