Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1, 2].sort({}) has unhelpful error message #2411

Closed
ljharb opened this issue Jan 25, 2017 · 0 comments
Closed

[1, 2].sort({}) has unhelpful error message #2411

ljharb opened this issue Jan 25, 2017 · 0 comments

Comments

@ljharb
Copy link
Collaborator

ljharb commented Jan 25, 2017

[1, 2].sort(true) and [1, 2].sort({}) throw a TypeError with the message "Array.prototype.sort: argument is not a JavaScript object".

This is unhelpful for true, and incorrect for {}. A better error message would perhaps be, `Array.prototype.sort: comparefn argument must be a function or undefined".

(discovered while looking into tc39/ecma262#785)

@dilijev dilijev added the Bug label Jan 30, 2017
@dilijev dilijev added this to the Backlog milestone Jan 30, 2017
@dilijev dilijev mentioned this issue Mar 9, 2017
5 tasks
@dilijev dilijev closed this as completed in 6644d34 Mar 9, 2017
dilijev added a commit that referenced this issue Mar 9, 2017
Merge pull request #2648 from xiaoyinl:fixbug2411

Unfortunately, there is no "argument must be a function or undefined" message defined in `rterrors.h`. The closest one is `JSERR_FunctionArgument_NeedFunction`: argument is not a Function object.

See #2411 for the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants