repository: cleanup error message on invalid data

The retry printed the filename twice:
```
Load(<lock/04804cba82>, 0, 0) returned error, retrying after 720.254544ms: load(<lock/04804cba82>): invalid data returned
```
now the warning has changed to
```
Load(<lock/04804cba82>, 0, 0) returned error, retrying after 720.254544ms: invalid data returned
```
This commit is contained in:
Michael Eischer 2023-01-14 16:04:14 +01:00
parent 5f97f534b1
commit 6d9675c323
2 changed files with 6 additions and 1 deletions

View File

@ -204,7 +204,8 @@ func (r *Repository) LoadUnpacked(ctx context.Context, t restic.FileType, id res
} else {
cancel()
}
return errors.Errorf("load(%v): invalid data returned", h)
return restic.ErrInvalidData
}
return nil
})

View File

@ -4,10 +4,14 @@ import (
"context"
"github.com/restic/restic/internal/crypto"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/ui/progress"
"golang.org/x/sync/errgroup"
)
// ErrInvalidData is used to report that a file is corrupted
var ErrInvalidData = errors.New("invalid data returned")
// Repository stores data in a backend. It provides high-level functions and
// transparently encrypts/decrypts data.
type Repository interface {