Mark S. Miller
erights at google.com
Wed Aug 19 08:50:20 PDT 2009
On Wed, Aug 19, 2009 at 3:31 AM, Jordan Osete<jor at joozt.net> wrote:
>Christian Plesner Hansen wrote :
>> [...] for instance if it
>> uses "typeof e.stack == 'string'" to check if a stack trace is
> I don't know if there is that much legacy code like that.
> Currently, AFAIK every implementation has a different way to get a stack
> trace, and every browser gives different info formated in different ways in
> those strings
As another data point, after a bit of testing I wrote:
* All the extra fields observed in Error objects on any supported
* browser which seem to carry possibly-useful diagnostic info.
* By "extra", we means any fields other that those already
* accessible to cajoled code, namely <tt>name</tt> and
var stackInfoFields = [
'stack', 'fileName', 'lineNumer', // Seen in FF 3.0.3
'description', // Seen in IE 6.0.2900, but seems identical to "message"
'stackTrace', // Seen on Opera 9.51 after enabling
// "opera:config#UserPrefs|Exceptions Have Stacktrace"
'sourceURL', 'line' // Seen on Safari 3.1.2
By "supported browser" above, we mean the Yahoo A-grade + Chrome.
Since the browser makers are all represented on this list, and since
the possible non-enumerability of built-in methods prevents any
systematic examination, I'll take this opportunity to ask: What else
is there? On IE, is "description" indeed always equivalent to
"message"? (If so, I'll drop it from the above list.)
More information about the es-discuss