How to improve error messages?
address must be a string and less than length 200 and more than length 50 and valid according to an anonymous predicate and valid according to an anonymous predicate and valid according to an anonymous predicate (was missing)This is an example of a validation error message returned. How could I go about making that a little more human friendly?
2 Replies
Haha.. interesting
Error messages usually aren't like this
The only reason this happened is because I decided it was better to describe the expected explicitly when a key was missing
Obviously since there is no value to check, it just has to describe something about what was missing, but given that example, I'll probably just default it to describe the domain and call it a day (e.g.
string
or object
)
But if you do something like const myType = type("string").describe("a special string")
, that will be what is populated in an error message like that by defaultGitHub
Only log domain of missing key in error · Issue #978 · arktypeio/ar...
A discord user mention seeing the following: address must be a string and less than length 200 and more than length 50 and valid according to an anonymous predicate and valid according to an anonym...