You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently the error message doesn't specify what value was received, only what was expected
Describe the solution you'd like
An error message similar to Expected value.name to be a string, but received ${JSON.stringify(value.name)}
instead of Expected value.name to be a string
Describe alternatives you've considered
Creating my own type with overridden error, but it takes some boilerplate and I think it would be good to have in the main type too.
Also I could just create a try/catch block and append it to the error myself, but then I would not have access to atomic values of the specific check, only to the entire object.
I'm just requesting, maybe it'll be useful as a feature. Or maybe it's too bloated for the scope of this lib.
The text was updated successfully, but these errors were encountered:
I think this is a good idea, but it has to be made optional.
For now you could use try/catch and raw errors, it'll give you the specific value and the expected value and you could build the error message yourself
This is a must-have feature for me. It’s very unnecessarily difficult to troubleshoot what went wrong when a check in some deeply nested object fails.
It'll give you the specific value and the expected value and you could build the error message yourself.
I don’t see how’s that possible – the raw error object (ValidationError) contains just the result of error[0].getRawTypeData(), not the Validator instance that provides the translate() method used to generate a human-readable description of the expected type.
Is your feature request related to a problem? Please describe.
Currently the error message doesn't specify what value was received, only what was expected
Describe the solution you'd like
An error message similar to
Expected value.name to be a string, but received ${JSON.stringify(value.name)}
instead of
Expected value.name to be a string
Describe alternatives you've considered
Creating my own type with overridden error, but it takes some boilerplate and I think it would be good to have in the main type too.
Also I could just create a try/catch block and append it to the error myself, but then I would not have access to atomic values of the specific check, only to the entire object.
I'm just requesting, maybe it'll be useful as a feature. Or maybe it's too bloated for the scope of this lib.
The text was updated successfully, but these errors were encountered: