cleanup: return error type in lookupRBDImageMetadataStash()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-12-08 15:09:59 +01:00 committed by mergify[bot]
parent 8e589587ae
commit f262673b60

View File

@ -1117,7 +1117,7 @@ func lookupRBDImageMetadataStash(path string) (rbdImageMetadataStash, error) {
encodedBytes, err := ioutil.ReadFile(fPath) // #nosec - intended reading from fPath encodedBytes, err := ioutil.ReadFile(fPath) // #nosec - intended reading from fPath
if err != nil { if err != nil {
if !os.IsNotExist(err) { if !os.IsNotExist(err) {
return imgMeta, fmt.Errorf("failed to read stashed JSON image metadata from path (%s): (%v)", fPath, err) return imgMeta, fmt.Errorf("failed to read stashed JSON image metadata from path (%s): %w", fPath, err)
} }
return imgMeta, util.JoinErrors(ErrMissingStash, err) return imgMeta, util.JoinErrors(ErrMissingStash, err)
@ -1125,7 +1125,7 @@ func lookupRBDImageMetadataStash(path string) (rbdImageMetadataStash, error) {
err = json.Unmarshal(encodedBytes, &imgMeta) err = json.Unmarshal(encodedBytes, &imgMeta)
if err != nil { if err != nil {
return imgMeta, fmt.Errorf("failed to unmarshall stashed JSON image metadata from path (%s): (%v)", fPath, err) return imgMeta, fmt.Errorf("failed to unmarshall stashed JSON image metadata from path (%s): %w", fPath, err)
} }
return imgMeta, nil return imgMeta, nil