Skip to content

Commit

Permalink
Use go error wrapping on file copy error for easier error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vansante committed Jan 11, 2021
1 parent 1ee1dbd commit 77b3bc0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tar.go
Expand Up @@ -399,7 +399,7 @@ func (t *Tar) Write(f File) error {
}
_, err := io.Copy(t.tw, f)
if err != nil {
return fmt.Errorf("%s: copying contents: %v", f.Name(), err)
return fmt.Errorf("%s: copying contents: %w", f.Name(), err)
}
}

Expand Down
2 changes: 1 addition & 1 deletion zip.go
Expand Up @@ -448,7 +448,7 @@ func (z *Zip) writeFile(f File, writer io.Writer) error {
}
_, err := io.Copy(writer, f)
if err != nil {
return fmt.Errorf("%s: copying contents: %v", f.Name(), err)
return fmt.Errorf("%s: copying contents: %w", f.Name(), err)
}

return nil
Expand Down

0 comments on commit 77b3bc0

Please sign in to comment.