mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
add missing proper error return in WalkDir() (#18884)
without this the caller might end up returning incorrect errors and not ignoring the drive properly.
This commit is contained in:
parent
32e668eb94
commit
6347fb6636
@ -407,12 +407,12 @@ func (client *storageRESTClient) WalkDir(ctx context.Context, opts WalkDirOption
|
||||
opts.DiskID = client.diskID
|
||||
b, err := opts.MarshalMsg(grid.GetByteBuffer()[:0])
|
||||
if err != nil {
|
||||
return err
|
||||
return toStorageErr(err)
|
||||
}
|
||||
|
||||
st, err := client.gridConn.NewStream(ctx, grid.HandlerWalkDir, b)
|
||||
if err != nil {
|
||||
return err
|
||||
return toStorageErr(err)
|
||||
}
|
||||
return toStorageErr(st.Results(func(in []byte) error {
|
||||
_, err := wr.Write(in)
|
||||
|
@ -87,6 +87,8 @@ func toStorageErr(err error) error {
|
||||
switch err.Error() {
|
||||
case errFaultyDisk.Error():
|
||||
return errFaultyDisk
|
||||
case errFaultyRemoteDisk.Error():
|
||||
return errFaultyRemoteDisk
|
||||
case errFileCorrupt.Error():
|
||||
return errFileCorrupt
|
||||
case errUnexpected.Error():
|
||||
@ -135,6 +137,16 @@ func toStorageErr(err error) error {
|
||||
return errDiskNotFound
|
||||
case errDiskNotFound.Error():
|
||||
return errDiskNotFound
|
||||
case errMaxVersionsExceeded.Error():
|
||||
return errMaxVersionsExceeded
|
||||
case errInconsistentDisk.Error():
|
||||
return errInconsistentDisk
|
||||
case errDriveIsRoot.Error():
|
||||
return errDriveIsRoot
|
||||
case errDiskOngoingReq.Error():
|
||||
return errDiskOngoingReq
|
||||
case grid.ErrUnknownHandler.Error():
|
||||
return errInconsistentDisk
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user