Closed Bug 874752 Opened 12 years ago Closed 12 years ago

Components.utils.reportError doesn't report a stack trace.

Categories

(Core :: XPConnect, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: markh, Unassigned)

Details

If code does something like: try { do_something_bad(); } catch (e) { Components.utils.reportError(e); } the exception value is written, but no stack information is, which can make debugging difficult. There are possibly a number of ways to skin that cat - in an ideal world, it could look something like: } catch (e) { Components.utils.reportException("something bad happened"); } and the given message, the pending exception and the stack-trace would all magically be written. I'd be happy to work on a patch if we can agree on the color...
Hm, I'm not sure if we currently have any C++ capability for dumping stacks to the error console. I know jetpack catches exceptions and logs them like that: http://mxr.mozilla.org/mozilla-central/source/addon-sdk/source/lib/sdk/console/traceback.js#74 I really don't want to do any more stack munging and string formatting than we have to in C++. It seems like this is something that could be accomplished with a JSM, no?
(In reply to Bobby Holley (:bholley) from comment #1) > It seems like this is something that could be > accomplished with a JSM, no? Well, it could be done directly in the code (eg, Cu.reportError(e + e.stack)) - it's just that people tend to not do that so we end up with messages which are far less useful than they could be. But yeah, I can accept this is probably INVALID/WONTFIX...
Yeah, this kind of stuff gets incredibly hairy in C++. I think the appropriate way forward here is to design a friendly error reporting API in JS and evangelize it.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
FTR, this got me thinking, which got me searching, which found me http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/Console.jsm - which really should be that standard mechanism we evangelize...
You need to log in before you can comment on or make changes to this bug.