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