-
Notifications
You must be signed in to change notification settings - Fork 151
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
Better error handling when the configuration file data structure is incorrect #102
Comments
An approach to this would be: try {
JSON.parse(config);
} catch (err) {
// auto-fix and/or log errors if it can't fix it
} There are some interesting solutions in this SO post (although most are for only fixing quote issues). https://jsontuneup.com/ might be a helpful example. In any case, this comes down to the CLI dependency not being able to parse a malformed configuration file. I started looking into that and found a decent library that provides much more informative errors and which I'm currently exploiting to see if I can get an auto-fixer into the mix. |
Added a module that will check JSON files and give a good level of details for errors while attempting to fix it re all-contributors/app#102
This also broke the schema. Specifying invalid contribution types in the JSON. See sentry: https://sentry.io/organizations/all-contributors/issues/957977140/events/50916998062/ |
* feat: added a JSON handler/fixer [wip] Added a module that will check JSON files and give a good level of details for errors while attempting to fix it re all-contributors/app#102 * refactor: consolidated the fix handler Made the fixer a bit more concise and added the fields to allow for an auto-update of the config file (if it was changed) * chore(package): use another `jsonlint` * refactor(config-file): use `json-fixer` * chore(package): bump `json-fixer` to 1.3 * chore(package): bumped `json-fixer`
Is your feature request related to a problem? Please describe.
When the configuration file datastructure is incorrect,the bot fails in weird and wonderful ways. e.g.
Technically valid JSON but the schema is busted.
Describe the solution you'd like
Provide great error messages, so users no whats wrong with the schema.
Even better: Auto fix it!
Additional context
See: https://sentry.io/all-contributors/github-bot/issues/859146506/?query=is%3Aunresolved
Also issues: zeroDevs/FullstackTrends_Challenge-13#182
The text was updated successfully, but these errors were encountered: