-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Unexpected behavior of console.log under certain condition #1634
Comments
can you provide a test script. im not sure why the behavior changed - but if you desire something specific we can nail it down. |
Was already attached but: https://gist.github.com/1189725 |
that doesn't tell me what you're expecting |
I expected the console.log(e) to output exacly the same as console.log(util.inspect(e, true, null)) - as it was working till 0.5.1 |
@kuebk - Since Node v0.5.1 (v8 3.4), all properties of @bnoordhuis - In some subclass of
I think it is not so useful. |
@koichik - that was my first take actually so yes, I can live with that. =) |
@koichik I didn't know that implemention in v8 <3.4 didn't follow specification. |
Umm, ick. Change 7292023 did indeed fix problem of util.inspect with exception objects. Thank you. But this leaves console.log('%j') still having changed behavior. ES5 specification broke my exceptional expectations for sure. Ick. Test older stable 0.4.x
Test recent master (showing problem)
(and also verified that Windows 0.5.5.exe had same results) after util: fix exception stringification in .format() Fixes # 1634.
|
Ah, yes, this is bs and a bug in V8. Someone misread the spec, Error.prototype properties vs. Error properties. http://code.google.com/p/v8/issues/detail?id=1595 @koichik: not all properties of Error ... 15.11.1.1 Error (message) If the argument message is not undefined, the message own property 15.11.2.1 new Error (message) If the argument message is not undefined, the message own property http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf Man, I shouldn't have stopped reviewing drafts mid-last year ... months of sending in "huh?" got pre-empted by "hey get back to work!" 15.11.4.4 Error.prototype.toString ( )
|
@tshinnic - Hmm... "8.6.1 Property Attributes" says:
Table 7:
And, In "15.11 Error Object", there is no property for which Note: an instance of But my English is very poor, I might be misreading the spec. |
Your English is very likely to be better than the English in the specification. And I see the reference in the table, and I'm having a hard time finding the exception to that general rule. So... I've posted the question on the es-discuss maillist. Hopefully they will pause talking about future ideas long enough to answer a concrete yes or no question. https://mail.mozilla.org/pipermail/es-discuss/2011-September/thread.html |
Okay, let's see how this one plays out. If V8 fixes it upstream, so much the better. |
Indeed, I keep seeing the same two responses from each person: "Yes, that's surprising" along with "Yes, that's the spec!" So we do need your fix, now and probably forever. x-( |
How about 23e4564?
|
@bnoordhuis - Can you review 7bf77fa? |
Sample code:
Under node 0.5.0 it results with:
But since 0.5.1 it resuls with:
First console.log is empty, why?
Thanks to @tereska for finding this.
The text was updated successfully, but these errors were encountered: