This is one of the few coding style questions I have strong opinon on and that is a preference to always catch the most specific exception (or throwable) possible, even if that means we wind up with multiple catch clauses. The reasonable exception I make is when we don't control the code that could be throwing and its known to behave erratically (for exmple flash or some graphics/media libraries that vary by device).
On Monday, August 31, 2015, Richard Newman <[email protected]> wrote: > In general, we will never spot an error if we log or catch. Only developers will see those, and if you're muffling to avoid user-visible behavior, succeeding means nobody will notice! > So our guideline is: if it's something wrong that we want to fix, let it crash, find and fix before release. > If it's something wrong that might seriously impact the user experience, or is not indicative of a programming error, then muffle but make sure we have a test or some other way to find the problem. > Or make sure that failure propagates around the application through some other kind of logic — return values, fall through, whatever. > Also: if you write 'catch Exception', consider writing 'Throwable' instead. I often see this: > // This might run out of memory. > catch (Exception e) { > which won't work — Exception and Error are siblings, and OOMs are OutOfMemoryErrors. That'll catch everything but an Error! -- -Brad
_______________________________________________ mobile-firefox-dev mailing list [email protected] https://mail.mozilla.org/listinfo/mobile-firefox-dev

