Skip to content

Commit a617d0e

Browse files
authored
Merge pull request moby#5657 from fiam/alberto/annotate-new-from-stat-error
chore: annotate errors returned from NewFromStat() with the file path
2 parents cac225d + 8d83d36 commit a617d0e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cache/contenthash/filehash.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"path/filepath"
99
"time"
1010

11+
"github.com/pkg/errors"
1112
fstypes "github.com/tonistiigi/fsutil/types"
1213
)
1314

@@ -46,7 +47,7 @@ func NewFromStat(stat *fstypes.Stat) (hash.Hash, error) {
4647
fi := &statInfo{stat}
4748
hdr, err := tar.FileInfoHeader(fi, stat.Linkname)
4849
if err != nil {
49-
return nil, err
50+
return nil, errors.Wrapf(err, "failed to checksum file %s", stat.Path)
5051
}
5152
hdr.Name = "" // note: empty name is different from current has in docker build. Name is added on recursive directory scan instead
5253
hdr.Devmajor = stat.Devmajor

0 commit comments

Comments
 (0)