Bug 157317 - Improve Symbol() to string coercion error message
Summary: Improve Symbol() to string coercion error message
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-03 12:10 PDT by Joseph Pecoraro
Modified: 2016-05-03 18:21 PDT (History)
4 users (show)

See Also:


Attachments
Patch (35.90 KB, patch)
2016-05-03 15:04 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-05-03 12:10:39 PDT
* SUMMARY
Improve Symbol() to string error message.

I'm not sure I agree with he "can't convert to a string" when Symbol().toString() at least provides a string. But still, our error message is super cryptic and needs to be improved.

* Safari
js> "" + Symbol()
TypeError: Type error

* Chrome
js> "" + Symbol()
TypeError: Cannot convert a Symbol value to a string

* Firefox
js> "" + Symbol()
TypeError: can't convert symbol to string

* Edge
js> "" + Symbol()
Object doesn't support property or method 'ToString'
Comment 1 Saam Barati 2016-05-03 14:54:52 PDT
Lol, that's a pretty bad error message. 
I think it would be worthwhile at some point
to vet all of our error messages and make them better.
Comment 2 Yusuke Suzuki 2016-05-03 15:04:46 PDT
Created attachment 278031 [details]
Patch
Comment 3 Yusuke Suzuki 2016-05-03 15:52:32 PDT
Comment on attachment 278031 [details]
Patch

Thanks!
Comment 4 WebKit Commit Bot 2016-05-03 18:21:02 PDT
Comment on attachment 278031 [details]
Patch

Clearing flags on attachment: 278031

Committed r200402: <http://trac.webkit.org/changeset/200402>
Comment 5 WebKit Commit Bot 2016-05-03 18:21:06 PDT
All reviewed patches have been landed.  Closing bug.