cli/context/store: make sure we handle wrapped errors

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-11-04 14:01:42 +01:00
parent 64e0a6cec6
commit 6a734df1cc
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 2 additions and 2 deletions

View File

@ -101,7 +101,7 @@ func (s *metadataStore) remove(name string) error {
func (s *metadataStore) list() ([]Metadata, error) {
ctxDirs, err := listRecursivelyMetadataDirs(s.root)
if err != nil {
if os.IsNotExist(err) {
if errors.Is(err, os.ErrNotExist) {
return nil, nil
}
return nil, err
@ -110,7 +110,7 @@ func (s *metadataStore) list() ([]Metadata, error) {
for _, dir := range ctxDirs {
c, err := s.getByID(contextdir(dir))
if err != nil {
if os.IsNotExist(err) {
if errors.Is(err, os.ErrNotExist) {
continue
}
return nil, errors.Wrap(err, "failed to read metadata")