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

Improve “Illegal invocation” error messages #222

Conversation

ExE-Boss
Copy link
Contributor

@ExE-Boss ExE-Boss commented May 3, 2020

The improved error message format is based on the one used in Firefox.


Related to #204 and #217.

@ExE-Boss ExE-Boss force-pushed the feat/better-error-messages/illegal-this-parameter branch 2 times, most recently from 1dbc5a0 to c8a6db2 Compare May 3, 2020 08:24
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great idea. However, I'd like to avoid using spec-facing terms like "interface". Maybe "called on an object that is not an instance of X"?

@ExE-Boss
Copy link
Contributor Author

ExE-Boss commented May 9, 2020

I went with: “'bar' called on an object that is not a valid instance of Foo.”, because Object.create(Foo.prototype) is an instance of Foo, but the WebIDL brand checks will fail, so it’s not a valid instance.

Same applies to ESNext classes with private fields.

@ExE-Boss ExE-Boss requested a review from domenic May 9, 2020 17:44
@TimothyGu TimothyGu merged commit 21a948e into jsdom:master May 10, 2020
@ExE-Boss ExE-Boss deleted the feat/better-error-messages/illegal-this-parameter branch May 10, 2020 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants