Skip to content

Commit fefef0b

Browse files
committed
don't swallow parse errors
1 parent 9ea9f40 commit fefef0b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

pkg/uploader/objectstore.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func GetVMIndex(store velero.ObjectStore, ns, name, bucket string, logger logr.L
399399
if err != nil {
400400
return vmIndex, false, fmt.Errorf("failed to read existing VM index: %w", err)
401401
}
402-
if err := json.Unmarshal(data, &vmIndex); err != nil {
402+
if err = json.Unmarshal(data, &vmIndex); err != nil {
403403
logger.Info("Failed to parse existing index, creating new", "reason", err.Error())
404404
exists = false
405405
}
@@ -412,7 +412,7 @@ func GetVMIndex(store velero.ObjectStore, ns, name, bucket string, logger logr.L
412412
Checkpoints: []CheckpointEntry{},
413413
}
414414
}
415-
return vmIndex, exists, nil
415+
return vmIndex, exists, err
416416
}
417417

418418
// GetVMIndexPath gets the path for the VMIndex
@@ -454,7 +454,7 @@ func GetBackupManifest(
454454
if err != nil {
455455
return backupManifest, false, fmt.Errorf("failed to read existing backup manifest: %w", err)
456456
}
457-
if err := json.Unmarshal(data, &backupManifest); err != nil {
457+
if err = json.Unmarshal(data, &backupManifest); err != nil {
458458
logger.Info("Failed to parse existing backup manifest, creating new", "reason", err.Error())
459459
exists = false
460460
}
@@ -467,7 +467,7 @@ func GetBackupManifest(
467467
VMs: []VMBackupReference{},
468468
}
469469
}
470-
return backupManifest, exists, nil
470+
return backupManifest, exists, err
471471
}
472472

473473
// GetBackupManifestPath gets the path for the BackupManifest
@@ -510,12 +510,12 @@ func GetVMBackupManifest(
510510
if err != nil {
511511
return vmBackupManifest, false, fmt.Errorf("failed to read existing vm backup manifest: %w", err)
512512
}
513-
if err := json.Unmarshal(data, &vmBackupManifest); err != nil {
513+
if err = json.Unmarshal(data, &vmBackupManifest); err != nil {
514514
logger.Info("Failed to parse existing vm backup manifest", "reason", err.Error())
515515
exists = false
516516
}
517517
}
518-
return vmBackupManifest, exists, nil
518+
return vmBackupManifest, exists, err
519519
}
520520

521521
// GetVMBackupManifestPath gets the path for the VMBackupManifest
@@ -648,7 +648,7 @@ func DeleteVMBT(store velero.ObjectStore, ns, name, checkpoint, bucket string) e
648648

649649
}
650650

651-
// GetQCOWPath gets the path for the VMBackupTracker
651+
// GetQCOWPath gets the path for the qcow2 file
652652
func GetQCOWPath(ns, name, checkpoint, qcowName string) string {
653653
return fmt.Sprintf("checkpoints/%s/%s/%s/%s", ns, name, checkpoint, qcowName)
654654
}

0 commit comments

Comments
 (0)