Skip to content

Commit

Permalink
Wrap errors on header writing (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
vansante authored Jan 12, 2021
1 parent acefb5f commit 074da64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func (t *Tar) Write(f File) error {

err = t.tw.WriteHeader(hdr)
if err != nil {
return fmt.Errorf("%s: writing header: %v", hdr.Name, err)
return fmt.Errorf("%s: writing header: %w", hdr.Name, err)
}

if f.IsDir() {
Expand Down
2 changes: 1 addition & 1 deletion zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ func (z *Zip) Write(f File) error {

writer, err := z.zw.CreateHeader(header)
if err != nil {
return fmt.Errorf("%s: making header: %v", f.Name(), err)
return fmt.Errorf("%s: making header: %w", f.Name(), err)
}

return z.writeFile(f, writer)
Expand Down

0 comments on commit 074da64

Please sign in to comment.