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

Throw the correct error when second argument to ow is undefined #239

Merged
merged 2 commits into from
Jun 13, 2022
Merged

Throw the correct error when second argument to ow is undefined #239

merged 2 commits into from
Jun 13, 2022

Conversation

fnesveda
Copy link
Contributor

When calling ow('value', undefined, ow.string), ow threw an unhelpful error:

TypeError: Cannot read property 'Symbol(test)' of undefined
      at isPredicate
...

because it tried to access a property on an undefined value.

This fixes it so that it throws the right error (as with other, non-undefined values):

Expected second argument to be a predicate or a string, got `undefined`

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
@sindresorhus sindresorhus merged commit 147b479 into sindresorhus:main Jun 13, 2022
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.

2 participants