util: Removing JoinError in favor of fmt.Errorf

Signed-off-by: Mike Perez <thingee@gmail.com>
This commit is contained in:
Mike Perez
2024-05-07 15:51:05 -07:00
committed by mergify[bot]
parent 8f7a4c43be
commit c8af2b638a
8 changed files with 14 additions and 111 deletions

View File

@ -140,7 +140,7 @@ func (s *subVolumeClient) GetVolumeRootPathCeph(ctx context.Context) (string, er
if err != nil {
log.ErrorLog(ctx, "failed to get the rootpath for the vol %s: %s", s.VolID, err)
if errors.Is(err, rados.ErrNotFound) {
return "", util.JoinErrors(cerrors.ErrVolumeNotFound, err)
return "", fmt.Errorf("Failed as %w (internal %w)", cerrors.ErrVolumeNotFound, err)
}
return "", err
@ -303,10 +303,10 @@ func (s *subVolumeClient) PurgeVolume(ctx context.Context, force bool) error {
if err != nil {
log.ErrorLog(ctx, "failed to purge subvolume %s in fs %s: %s", s.VolID, s.FsName, err)
if strings.Contains(err.Error(), cerrors.VolumeNotEmpty) {
return util.JoinErrors(cerrors.ErrVolumeHasSnapshots, err)
return fmt.Errorf("Failed as %w (internal %w)", cerrors.ErrVolumeHasSnapshots, err)
}
if errors.Is(err, rados.ErrNotFound) {
return util.JoinErrors(cerrors.ErrVolumeNotFound, err)
return fmt.Errorf("Failed as %w (internal %w)", cerrors.ErrVolumeNotFound, err)
}
return err

View File

@ -390,7 +390,7 @@ func NewVolumeOptionsFromVolID(
if err != nil {
err = fmt.Errorf("error decoding volume ID (%s): %w", volID, err)
return nil, nil, util.JoinErrors(cerrors.ErrInvalidVolID, err)
return nil, nil, fmt.Errorf("Failed as %w (internal %w)", cerrors.ErrInvalidVolID, err)
}
volOptions.ClusterID = vi.ClusterID
vid.VolumeID = volID