Skip to content

Commit

Permalink
Merge pull request #240 from quite/do-wrap
Browse files Browse the repository at this point in the history
Wrap errors, not Unwrap
  • Loading branch information
deitch committed Jul 22, 2024
2 parents 40221ec + 2b170e7 commit bd61c20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diskfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ func Create(device string, size int64, _ Format, sectorSize SectorSize) (*disk.D
}
f, err := os.OpenFile(device, os.O_RDWR|os.O_EXCL|os.O_CREATE, 0o666)
if err != nil {
return nil, fmt.Errorf("could not create device %s: %v", device, errors.Unwrap(err))
return nil, fmt.Errorf("could not create device %s: %w", device, err)
}
err = os.Truncate(device, size)
if err != nil {
return nil, fmt.Errorf("could not expand device %s to size %d: %v", device, size, errors.Unwrap(err))
return nil, fmt.Errorf("could not expand device %s to size %d: %w", device, size, err)
}
// return our disk
return initDisk(f, ReadWriteExclusive, sectorSize)
Expand Down

0 comments on commit bd61c20

Please sign in to comment.