include file path in upload error (#327)
diff --git a/go/pkg/client/cas.go b/go/pkg/client/cas.go
index 116c445..a86e04a 100644
--- a/go/pkg/client/cas.go
+++ b/go/pkg/client/cas.go
@@ -453,7 +453,7 @@
}
written, err := c.writeChunked(eCtx, c.writeRscName(dg), ch)
if err != nil {
- return err
+ return fmt.Errorf("failed to upload %s: %w", ue.Path, err)
}
atomic.AddInt64(&totalBytesTransferred, written)
}
diff --git a/go/pkg/client/cas_test.go b/go/pkg/client/cas_test.go
index 6c3311c..23e490a 100644
--- a/go/pkg/client/cas_test.go
+++ b/go/pkg/client/cas_test.go
@@ -4,6 +4,7 @@
"bytes"
"context"
"encoding/binary"
+ "errors"
"fmt"
"io/ioutil"
"math/rand"
@@ -599,8 +600,8 @@
eg, _ := errgroup.WithContext(cCtx)
ue := uploadinfo.EntryFromBlob(blob)
eg.Go(func() error {
- if _, _, err := c.UploadIfMissing(cCtx, ue); err != context.Canceled {
- return fmt.Errorf("c.UploadIfMissing(ctx, input) gave error %v, expected context.Canceled", err)
+ if _, _, err := c.UploadIfMissing(cCtx, ue); !errors.Is(err, context.Canceled) {
+ return fmt.Errorf("c.UploadIfMissing(ctx, input) gave error %v, expected to wrap context.Canceled", err)
}
return nil
})