-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Constructor throws exception if underlying Config is invalid #187
Comments
Same issue |
Same issue, would really like to be able to log / handle errors but still be able to create a Store and get values from other collections / properties within a collection which do pass validation |
This issue sounds similar to #173. I'm really hoping we can get this sorted, and see this meaningful improvement included in this library. Unfortunately, that issue has already been inactive since the beginning of 2023 |
@BittnerBarnabas with #194 merged you should be able to write a migration to update your schema to a valid schema before validation is ran. Can you test with 13.0.1 to see if implementing a migration resolves your issue? |
Trying to use the component in an electron app, with specifying the JSON schema.
What I expect is that I can create the store with a potentially invalid underlying config, but when I call
store.get(key)
an exception should be thrown that the config is not valid.What happens currently is that an exception is thrown from the constructor, as it seems there's no way to disable validation when the object is created: https://github.com/sindresorhus/conf/blob/main/source/index.ts#L133 . Currently, this makes it impossible to gracefully fix the config,
the only option is to nuke the whole thing with. <- just tested this, doesn't work 😞clearInvalidConfig
which will make users really mad that they lose their whole configExample:
config.json
contents:Code:
This throws an exception right away
Error: Config schema violation: 'myKey' must be boolean
.The text was updated successfully, but these errors were encountered: