From 7f65b344d7b2de74ffb0ff4f876bec776a05ad78 Mon Sep 17 00:00:00 2001 From: Erin Pentecost Date: Thu, 15 Jul 2021 11:22:53 -0700 Subject: [PATCH] wrap errors --- localfs/store.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/localfs/store.go b/localfs/store.go index fd8e6a6..8657945 100644 --- a/localfs/store.go +++ b/localfs/store.go @@ -280,12 +280,12 @@ func (l *LocalStore) Get(ctx context.Context, o string) (cloudstorage.Object, er func (l *LocalStore) Delete(ctx context.Context, obj string) error { fo := path.Join(l.storepath, obj) if err := os.Remove(fo); err != nil { - return err + return fmt.Errorf("removing dir=%s: %w", fo, err) } mf := fo + ".metadata" if cloudstorage.Exists(mf) { if err := os.Remove(mf); err != nil { - return err + return fmt.Errorf("removing dir=%s: %w", mf, err) } } @@ -299,7 +299,7 @@ func (l *LocalStore) Delete(ctx context.Context, obj string) error { dir.Close() // it's empty, so remove it. if err := os.Remove(l.storepath); err != nil { - return err + return fmt.Errorf("failed to remove store dir=%s err=%w", l.storepath, err) } } else { dir.Close()