2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 14:17:42 +00:00

Improve error message for readdir/readdirnames

As mentioned in the forum[1], restic does not include the dir name when
readdir/readdirnames fails.

[1] https://forum.restic.net/t/readdirnames-readdirent-no-such-file-or-directory/653
This commit is contained in:
Alexander Neumann 2018-05-13 10:34:50 +02:00
parent 159badf5ba
commit 60ea2435be

View File

@ -623,7 +623,7 @@ func readdir(filesystem fs.FS, dir string) ([]os.FileInfo, error) {
entries, err := f.Readdir(-1) entries, err := f.Readdir(-1)
if err != nil { if err != nil {
_ = f.Close() _ = f.Close()
return nil, errors.Wrap(err, "Readdir") return nil, errors.Wrapf(err, "Readdir %v failed: %v", dir, err)
} }
err = f.Close() err = f.Close()
@ -644,7 +644,7 @@ func readdirnames(filesystem fs.FS, dir string) ([]string, error) {
entries, err := f.Readdirnames(-1) entries, err := f.Readdirnames(-1)
if err != nil { if err != nil {
_ = f.Close() _ = f.Close()
return nil, errors.Wrap(err, "Readdirnames") return nil, errors.Wrapf(err, "Readdirnames %v failed: %v", dir, err)
} }
err = f.Close() err = f.Close()