Repository navigation
fix: return error when config file cannot be parsed - #574
Sarthak-Shreshtha01 wants to merge 3 commits into
Conversation
Signed-off-by: Sarthak <sarthakshreshtha345@gmail.com>
|
Hi @Sarthak-Shreshtha01, thank you for submitting this PR! It looks like the review couldn't complete because your GitHub Copilot review quota was reached. Additionally, please make sure to check our contribution guidelines and this issue #559 regarding monthly PR limits before creating a new PR. Thanks again for contributing! |
ReadLocalConfig and ReadLocalWatchConfig returned a plain fmt.Errorf for a malformed config file instead of going through errors.Wrap like the rest of pkg/*. Per documentation/error-handling.md, a malformed local input file is errors.KindUsage, so wrap it that way and assert the kind in TestReadMalformedConfig. Signed-off-by: Sarthak <sarthakshreshtha345@gmail.com>
|
@Harsh4902 Both read errors in |
|
Tested this branch on a build of the PR head.
Disclosure: this comment was drafted with AI assistance and the results were run locally. |
Most commands already wrap config read errors as KindEnvironment, so the same bad file exited with 2 from logout, stop and login but 14 from context, import and start. Use KindEnvironment in ReadLocalConfig and ReadLocalWatchConfig so every command exits the same way. Signed-off-by: Sarthak <sarthakshreshtha345@gmail.com>
|
@yada |
|
Re-tested the current head (22f6bb1):
Looks good from my side. Disclosure: this comment was drafted with AI assistance, and the results were run locally. |
|
Re-verified the current head against
@Harsh4902 your Oct 9 comments asked for the centralised error handling. Since then the PR wraps both read errors with Disclosure: this comment was drafted with AI assistance, and the results were run locally. |
|
Thanks @Sarthak-Shreshtha01, this fixes a real data-loss bug. Could you rebase and keep both sets of tests? |
|
This pull request has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 30 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation. There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. Microcks is a Cloud Native Computing Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
ReadLocalConfigandReadLocalWatchConfignow return an error when the config file has invalid YAML, instead of an empty config. Before,logintreated the broken file as a fresh install and overwrote all other contexts. The related tests pass, including the newTestReadMalformedConfig.Fixes #572