Start using error wrapping with fmt.Errorf (#8588)

Use fatih/errwrap to fix all the code to use
error wrapping with fmt.Errorf()
This commit is contained in:
Harshavardhana
2019-12-02 09:28:01 -08:00
committed by GitHub
parent 0bfd20a8e3
commit 5d3d57c12a
23 changed files with 113 additions and 112 deletions

View File

@@ -95,14 +95,14 @@ func getModTime(path string) (t time.Time, err error) {
// Convert to absolute path
absPath, err := filepath.Abs(path)
if err != nil {
return t, fmt.Errorf("Unable to get absolute path of %s. %s", path, err)
return t, fmt.Errorf("Unable to get absolute path of %s. %w", path, err)
}
// Version is minio non-standard, we will use minio binary's
// ModTime as release time.
fi, err := os.Stat(absPath)
if err != nil {
return t, fmt.Errorf("Unable to get ModTime of %s. %s", absPath, err)
return t, fmt.Errorf("Unable to get ModTime of %s. %w", absPath, err)
}
// Return the ModTime
@@ -385,7 +385,7 @@ func parseReleaseData(data string) (sha256Hex string, releaseTime time.Time, err
releaseTime, err = releaseTagToReleaseTime(nfields[1])
if err != nil {
err = fmt.Errorf("Unknown release tag format. %s", err)
err = fmt.Errorf("Unknown release tag format. %w", err)
}
return sha256Hex, releaseTime, err