Improve error messages

This commit is contained in:
Alexander Neumann 2017-02-11 14:24:11 +01:00
parent 7797e084f9
commit 0492eabff1

View file

@ -56,12 +56,12 @@ func (r *Repository) LoadAndDecrypt(t restic.FileType, id restic.ID) ([]byte, er
h := restic.Handle{Type: t, Name: id.String()}
buf, err := backend.LoadAll(r.be, h)
if err != nil {
debug.Log("error loading %v: %v", id.Str(), err)
debug.Log("error loading %v: %v", h, err)
return nil, err
}
if t != restic.ConfigFile && !restic.Hash(buf).Equal(id) {
return nil, errors.New("invalid data returned")
return nil, errors.Errorf("%v: invalid data returned", h)
}
// decrypt