Remove ValidationError.annotate() from browser build
With 17.0.2 I get Error: Error annotation is not supported when Joi.assert validation error occurs in the browser.
I couldn't find any mention of it outside of this issue and linked release notes. The validation error message is fine in 16.1.8.
I’m confused. It’s clearly documented exactly where it should be. What’s the issue?
Sorry, I (grossly) misunderstood this issue. Is there another of getting validation error details when using browser build? Should I supply my own annotate implementation?
The annotate method is used mostly for displaying pretty errors in CLI tools. The error you get already includes all the information you need to handle it programmatically. Why do you need to annotate errors for console display in the browser?
I don't. This is not something I do manually. When used like this:
try {
Joi.assert(…)
} catch(e) {
debugger
}
Annotate is being called internally so the error I get is not the ValidationError instance but the error resulting from trying to call ValidationError.annotate. Is assert not the intended method in such case (in browser)?
Got it! I'll get that fixed.