Closed Bug 1263747 Opened 8 years ago Closed 8 years ago

Console.jsm should log error messages when stringifying errors

Categories

(Toolkit :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: lina, Assigned: lina)

Details

Attachments

(1 file)

Console.jsm uses `JSON.stringify` when printing error objects via `dump`. Unfortunately, this makes the error a bit vague: for example, https://treeherder.mozilla.org/logviewer.html#?job_id=19148268&repo=try#L4186.

It would help if we could log the error name and message in this case. I think it's fine to omit the stack, since that could take up multiple lines and introduce noise.
Attachment #8740148 - Flags: review?(bgrinstead) → review+
Comment on attachment 8740148 [details]
MozReview Request: Bug 1263747 - Log error messages when stringifying errors. r?bgrins

https://reviewboard.mozilla.org/r/45587/#review42133

nice

::: toolkit/modules/Console.jsm:117
(Diff revision 1)
> +          The object to check
> + * @return {boolean}
> +          Is this object an error?
> + */
> +function isError(aThing) {
> +  return (typeof aThing.name == "string" &&

Think it'd be safest to include `if (typeof aThing == "object")` in this chain so we don't have to assume it's already been null checked
https://hg.mozilla.org/mozilla-central/rev/ea4c6f1f0ff0
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.