mirror of
https://github.com/octoleo/restic.git
synced 2024-11-11 15:51:02 +00:00
repository: use fmt.Errorf in StreamPacks
This commit is contained in:
parent
6fbb470835
commit
18b0bbbf42
@ -1079,7 +1079,7 @@ func (b *PackBlobIterator) Next() (PackBlobValue, error) {
|
||||
|
||||
skipBytes := int(entry.Offset - b.currentOffset)
|
||||
if skipBytes < 0 {
|
||||
return PackBlobValue{}, errors.Errorf("overlapping blobs in pack %v", b.packID)
|
||||
return PackBlobValue{}, fmt.Errorf("overlapping blobs in pack %v", b.packID)
|
||||
}
|
||||
|
||||
_, err := b.rd.Discard(skipBytes)
|
||||
@ -1099,18 +1099,18 @@ func (b *PackBlobIterator) Next() (PackBlobValue, error) {
|
||||
n, err := io.ReadFull(b.rd, b.buf)
|
||||
if err != nil {
|
||||
debug.Log(" read error %v", err)
|
||||
return PackBlobValue{}, errors.Wrap(err, "ReadFull")
|
||||
return PackBlobValue{}, fmt.Errorf("readFull: %w", err)
|
||||
}
|
||||
|
||||
if n != len(b.buf) {
|
||||
return PackBlobValue{}, errors.Errorf("read blob %v from %v: not enough bytes read, want %v, got %v",
|
||||
return PackBlobValue{}, fmt.Errorf("read blob %v from %v: not enough bytes read, want %v, got %v",
|
||||
h, b.packID.Str(), len(b.buf), n)
|
||||
}
|
||||
b.currentOffset = entry.Offset + entry.Length
|
||||
|
||||
if int(entry.Length) <= b.key.NonceSize() {
|
||||
debug.Log("%v", b.blobs)
|
||||
return PackBlobValue{}, errors.Errorf("invalid blob length %v", entry)
|
||||
return PackBlobValue{}, fmt.Errorf("invalid blob length %v", entry)
|
||||
}
|
||||
|
||||
// decryption errors are likely permanent, give the caller a chance to skip them
|
||||
@ -1130,7 +1130,7 @@ func (b *PackBlobIterator) Next() (PackBlobValue, error) {
|
||||
if !id.Equal(entry.ID) {
|
||||
debug.Log("read blob %v/%v from %v: wrong data returned, hash is %v",
|
||||
h.Type, h.ID, b.packID.Str(), id)
|
||||
err = errors.Errorf("read blob %v from %v: wrong data returned, hash is %v",
|
||||
err = fmt.Errorf("read blob %v from %v: wrong data returned, hash is %v",
|
||||
h, b.packID.Str(), id)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user