refactor: use static error object

This commit is contained in:
Derrick Hammer 2024-03-01 20:54:16 -05:00
parent 1c8efbfba8
commit eb4e4a9f37
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 1 deletions

View File

@ -29,6 +29,10 @@ var (
_ service.StorageService = (*StorageService)(nil) _ service.StorageService = (*StorageService)(nil)
) )
var (
ErrUnsupportedMetaFormat = errors.New("unsupported metadata format")
)
type StorageService struct { type StorageService struct {
metadataCache structs.Map metadataCache structs.Map
providerStore storage.ProviderStore providerStore storage.ProviderStore
@ -316,7 +320,7 @@ func (s *StorageService) GetMetadataByCID(cid *encoding.CID) (md metadata.Metada
return nil, err return nil, err
} }
default: default:
return nil, errors.New("unsupported metadata format") return nil, ErrUnsupportedMetaFormat
} }
s.metadataCache.Put(hashStr, md) s.metadataCache.Put(hashStr, md)