[whatwg] Stack trace in window.onerror

James Greene james.m.greene at gmail.com
Fri Jul 26 13:21:40 PDT 2013


Ian —
So Paul Irish pointed out to me that the spec has just been updated to
include this:
    http://html5.org/tools/web-apps-tracker?from=8085&to=8086


Yay, that's awesome!  :)


*Two things:*
*
*
*#1.*
My last name ends with an 'e' ('Greene' vs. 'Green').  Please correct that
when you get a chance. Thanks!

*#2.*
You had mentioned earlier that there is already a window 'error' event that
can be listened to via `window.addEventListener('error', fn, false);` if
you don't use `window.onerror = fn;`:

There's already an event. You can get it if you use addEventListener()
for 'error'
> rather than using onerror.



(It's also exposed on the event object, for those of you using
addEventListener()
> for error events rather than onerror.)


Is that clarified in the spec somewhere already? Although that makes
perfect sense to me, I have never noticed it before nor heard of any
browser vendors implementing such.  Have there been any such
implementations yet?  If so, that's *wonderful* news.  :)


Sincerely,
    James Greene



On Wed, Jul 24, 2013 at 4:27 PM, James Greene <james.m.greene at gmail.com>wrote:

> Rick —
> Thanks for clarifying/correcting both my comment and Hixie's!
>
> Sincerely,
>     James Greene
>
>
>
> On Wed, Jul 24, 2013 at 4:24 PM, Rick Waldron <waldron.rick at gmail.com>wrote:
>
>> On Wed, Jul 24, 2013 at 2:50 PM, Ian Hickson <ian at hixie.ch> wrote:
>>
>> > On Fri, 12 Jul 2013, James Greene wrote:
>> > > On Fri, Jul 12, 2013 at 12:17 PM, Ian Hickson <ian at hixie.ch> wrote:
>> > > > On Tue, 5 Feb 2013, Nathan Broadbent wrote:
>> > > > >
>> > > > > The current information passed to window.onerror rarely provides
>> > > > > sufficient information to find the cause of the error. The column
>> > > > > number argument will be a big step forward, but a stack trace
>> would
>> > > > > be especially useful. I would like to add my support for improving
>> > > > > the window.onerror arguments, with a fifth argument for stack
>> trace.
>> > > > > Is there anything that James or I could do to move this discussion
>> > > > > along?
>> > > >
>> > > > This seems useful, but I don't think it's specific to
>> window.onerror.
>> > > > I would recommend approaching the es-discuss list about this.
>> > >
>> > > I'm curious: would do you say that?  All evergreen browsers already
>> > > include a `stack` property on their core `Error` prototypes, so it
>> seems
>> > > to me that the only thing preventing us from getting that useful
>> > > information for unhandled errors is the fact that `window.onerror`
>> does
>> > > not provide us with a real Error object instances (or even fake ones
>> > > with shell properties in the case of cross-domain errors).
>> >
>> > Ah, I was unaware of Error.stack. Interesting!
>> >
>>
>> There is no static property with the name "stack" on the [[Global]]
>> built-in Error object, nor is the property added to Error.prototype. In
>> v8,
>> SpiderMonkey and JSC, the stack property appears on the actual instance
>> object initialized by Error.
>>
>>
>>
>> Rick
>>
>
>



More information about the whatwg mailing list