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 error message when using oneOf validation #254

Closed
robframpton opened this issue Sep 1, 2017 · 3 comments
Closed

Improve error message when using oneOf validation #254

robframpton opened this issue Sep 1, 2017 · 3 comments
Milestone

Comments

@robframpton
Copy link

When using oneOf validation for a Component property, I would like the error message to display the valid types.

This is what is currently displayed.

Error: Warning: Invalid state passed to 'type'. Expected one of given values. Passed to 'MyComponent'.

This is what I'd like to see.

Error: Warning: Invalid state passed to 'type'. Expected one of the following values: 'value1', 'value2', 'value3'. Passed to 'MyComponent'.
@robframpton
Copy link
Author

@mthadley @bryceosterhaus, as you guys have used these kind of validators a lot, what do you think?

@mthadley
Copy link

mthadley commented Sep 2, 2017

Sounds like an awesome improvement to me. Since any type can appear in oneOf, we should also make sure developers don't end up with something like this in their console:

Expected one of the following values: '[object Object]', '[object Object]', '[object Object]'.

robframpton pushed a commit to robframpton/metal.js that referenced this issue Oct 6, 2017
jbalsas added a commit that referenced this issue Oct 11, 2017
Improves error message when using `oneOf` validation. 

Fixes #254
@jbalsas jbalsas added this to the 2.14.0 milestone Oct 11, 2017
@jbalsas
Copy link
Contributor

jbalsas commented Oct 11, 2017

This has already been merged into develop!

@jbalsas jbalsas closed this as completed Oct 11, 2017
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

No branches or pull requests

3 participants