Open Bug 517732 Opened 16 years ago

Don't abuse try-catch to work around proper error checking

Categories

(SeaMonkey :: MailNews: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: mnyromyr, Unassigned)

Details

We've quite some function in mailnews land which, instead of proper error checking, just wrap up stuff in a try-catch block. We should use try-catch only for catching exceptions, not errors. (On a sidenote, these error catches unnecessarily clutter Venkman's Interactive Session window.) Example: gDBView problems are frequently handled that way, e.g. | Error ``gDBView is null'' [x-] in file | ``chrome://messenger/content/mail3PaneWindowCommands.js'', | line 760, character 0. function GetNumSelectedMessages() { try { return gDBView.numSelected; } catch (ex) { return 0; } } should just be function GetNumSelectedMessages() { if (gDBView) return gDBView.numSelected; return 0; } (given that numSelected doesn't throw exceptions which I didn't check).
You need to log in before you can comment on or make changes to this bug.