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!
_______________________________________________
mobile-firefox-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to