-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
throw config error based on the joi validation error #29137
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending green CI - Tested locally. If there isn't a rush, let's wait on merging until @azasypkin also has a chance to review.
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -124,7 +124,10 @@ export class Config { | |||
}); | |||
|
|||
if (results.error) { | |||
throw results.error; | |||
const error = new Error(results.error.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I prefer your solution to something like delete results.error._object;
or dealing with any.error(...)
since:
- we don't rely on Joi internals
- we throw error that we control (and ideally we should do that everywhere)
No description provided.