Closed Bug 772855 Opened 12 years ago Closed 12 years ago

Log exception stack traces when logging errors

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 17

People

(Reporter: kats, Assigned: kats)

Details

Attachments

(1 file)

Attached patch Log stack tracesSplinter Review
We have a lot of code of the form:

catch (Exception e) {
  Log.e(LOGTAG, "some exception was thrown: " + e);
}

This just prints out the description of the exception which may or may not be very useful. It is better to do this instead:

catch (Exception e) {
  Log.e(LOGTAG, "some exception was thrown", e);
}

which will also print the stack trace of the exception.
Attachment #641058 - Flags: review?(mark.finkle)
Comment on attachment 641058 [details] [diff] [review]
Log stack traces

Moving review since mfinkle is on PTO.
Attachment #641058 - Flags: review?(mark.finkle) → review?(cpeterson)
Comment on attachment 641058 [details] [diff] [review]
Log stack traces

Review of attachment 641058 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM \o/

I feel we catch-and-ignore too many exceptions. This patch to log the exception stack traces is a good step in the right direction.

btw, this design anti-pattern of catching too many exceptions is apparently known as "Pokémon exception handling" because "You Gotta Catch 'Em All!" :)
Attachment #641058 - Flags: review?(cpeterson) → review+
(In reply to Chris Peterson (:cpeterson) from comment #2)
> btw, this design anti-pattern of catching too many exceptions is apparently
> known as "Pokémon exception handling" because "You Gotta Catch 'Em All!" :)

Lol, first time I'm hearing of that. Makes perfect sense :)

Landed on inbound:
https://hg.mozilla.org/integration/mozilla-inbound/rev/3f8e838c255a
https://hg.mozilla.org/mozilla-central/rev/3f8e838c255a
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 17
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: