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

@@ -489,7 +489,7 @@ func formatXLFixDeploymentID(endpoints Endpoints, storageDisks []StorageAPI, ref
formats, sErrs := loadFormatXLAll(storageDisks)
for i, sErr := range sErrs {
if _, ok := formatCriticalErrors[sErr]; ok {
return fmt.Errorf("Disk %s: %s", endpoints[i], sErr)
return fmt.Errorf("Disk %s: %w", endpoints[i], sErr)
}
}
@@ -547,7 +547,7 @@ func formatXLFixLocalDeploymentID(endpoints Endpoints, storageDisks []StorageAPI
format.ID = refFormat.ID
if err := saveFormatXL(storageDisk, format); err != nil {
logger.LogIf(context.Background(), err)
return fmt.Errorf("Unable to save format.json, %s", err)
return fmt.Errorf("Unable to save format.json, %w", err)
}
}
}
@@ -747,7 +747,7 @@ func initFormatXL(ctx context.Context, storageDisks []StorageAPI, setCount, driv
// Initialize meta volume, if volume already exists ignores it.
if err := initFormatXLMetaVolume(storageDisks, formats); err != nil {
return format, fmt.Errorf("Unable to initialize '.minio.sys' meta volume, %s", err)
return format, fmt.Errorf("Unable to initialize '.minio.sys' meta volume, %w", err)
}
// Save formats `format.json` across all disks.