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

Remove ValidationError.annotate() from browser build #2261

Closed
hueniverse opened this issue Jan 4, 2020 · 6 comments
Closed

Remove ValidationError.annotate() from browser build #2261

hueniverse opened this issue Jan 4, 2020 · 6 comments
Assignees
Labels
breaking changes Change that can breaking existing code
Milestone

Comments

@hueniverse
Copy link
Contributor

No description provided.

@hueniverse hueniverse added the breaking changes Change that can breaking existing code label Jan 4, 2020
@hueniverse hueniverse added this to the 17.0.0 milestone Jan 4, 2020
@hueniverse hueniverse self-assigned this Jan 4, 2020
@adambuczek
Copy link

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.

@hueniverse
Copy link
Contributor Author

I’m confused. It’s clearly documented exactly where it should be. What’s the issue?

@adambuczek
Copy link

adambuczek commented Jan 19, 2020

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?

@hueniverse
Copy link
Contributor Author

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?

@adambuczek
Copy link

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)?

@hueniverse
Copy link
Contributor Author

Got it! I'll get that fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes Change that can breaking existing code
Projects
None yet
Development

No branches or pull requests

2 participants