2 ms·
Error message "" is very different from no error message. Any legitimate use case for a null/absent string is an example; all those use cases are arguable and d
by lmm 6y ago
Error message "" is very different from no error message. Any legitimate use case for a null/absent string is an example; all those use cases are arguable and domain-specific, but they're a different thing from blank. For example if you're using null/absent to represent "unknown" then your search behaviour should be different from empty - for your example of middle names, a search with first=William/middle=Henry/last=Gates should return records with middle=null, but should not return records with middle="".
- earthboundkid 6y agoWhy would you send a blank error message? Surely you would at least send “Unknown error”.
- lmm 6y agoYou probably wouldn't send "hlcrkorluatnsuh" either. But using that to represent "no error" would still be a bad idea.
- earthboundkid 6y agoI don’t understand what the structure you’re proposing is. There are a lot of ways of doing form validation. Typically you’ll have field levels errors and form level errors. In those cases, the no error state is represented by an empty list. I have never seen errors represented in a way that null means no error but blank string means unknown error. That would be a weird way to represent it.
- earthboundkid 6y agoIncidentally, the JS DOM represents no error on an input element as a blank string, not null: https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/setCustomValidity https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectE...