Closed Bug 804849 Opened 12 years ago Closed 12 years ago

When logging nsresult values, convert to a human-readable string representation

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: rnewman, Assigned: Unfocused)

Details

Attachments

(1 file)

I'm having trouble debugging Bug 804480, so it's time to add some logging.
Meh, not important enough.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
Yes, important enough :) I'm always on the lookout to improve the usefulness of the Add-ons Manager logging.

The download failed log isn't terribly humane there, just logging the integer value of the status code (bug 759642 fixes almost every case of that but this one). So that, at least, is an easy win.
Assignee: rnewman → bmcbride
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Summary: Additional logging in XPIProvider → Log a more humane message when xpi download fails
Summary: Log a more humane message when xpi download fails → When logging nsresult values, convert to a human-readable string representation
Attached patch Patch v1Splinter Review
A more generic fix to make AddonLogger smarter. Components.Exception().name is a convenient but slightly obscure way to convert between a nsresult value and a string representation of that value.

This makes it so running something like this:
  AddonManager.getInstallForURL("http://something.invalid/notthere.xpi",
                                function(install) { install.install(); },
                                "application/x-xpinstall");

Will result in the following log output:
  Warning: WARN addons.xpi: Download failed: NS_ERROR_UNKNOWN_HOST

Instead of the existing log output:
  Warning: WARN addons.xpi: Download failed: 2152398878
Attachment #674515 - Flags: review?(dtownsend+bugmail)
Comment on attachment 674515 [details] [diff] [review]
Patch v1

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

That would save me some time with <http://james-ross.co.uk/mozilla/misc/nserror>!
Attachment #674515 - Flags: feedback+
Comment on attachment 674515 [details] [diff] [review]
Patch v1

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

Clever trick
Attachment #674515 - Flags: review?(dtownsend+bugmail) → review+
https://hg.mozilla.org/integration/fx-team/rev/3e9ca49bd35f
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → mozilla19
https://hg.mozilla.org/mozilla-central/rev/3e9ca49bd35f
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: