fix(cosmic_config): Make get_local
return key_path()
error
#948
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It looks like this was changed to be like this in cd8f4ee. But
key_path()
only seems to returnError::NoConfigDirectory
orError::InvalidName
, so it seems reasonable to just updateget()
to also check forNoConfigDirectory
. (get_local()
doesn't seem to be used elsewhere, so I don't see nay issues this can cause.)It's also a bit odd that
get_default()
doesn't map errors toNotFound
. I guessis_err()
should returntrue
if the default config doesn't exist, since (at least for some settings) it's important to have default configurations present? But thenget_system_default()
could returnNoConfigDirectory
from the.default_path()
call, which has the same issue...Also, maybe using
is_file()
, then reading the file, is racy. Not that it should matter that much, but just checking for not found errors from theread_to_string
call is probably sufficient.Leaving as a draft while considering these other issues.