mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Extract rpc server wrapped errors and translate to storage error.
This commit is contained in:
parent
cae5761f16
commit
6908a0dcd4
@ -18,6 +18,7 @@ package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"net/rpc"
|
||||
"path"
|
||||
"strconv"
|
||||
@ -49,6 +50,12 @@ func splitNetPath(networkPath string) (netAddr, netPath string) {
|
||||
// disks as well.
|
||||
func toStorageErr(err error) error {
|
||||
switch err.Error() {
|
||||
case io.EOF.Error():
|
||||
return io.EOF
|
||||
case io.ErrUnexpectedEOF.Error():
|
||||
return io.ErrUnexpectedEOF
|
||||
case errUnexpected.Error():
|
||||
return errUnexpected
|
||||
case errDiskFull.Error():
|
||||
return errDiskFull
|
||||
case errVolumeNotFound.Error():
|
||||
@ -57,14 +64,20 @@ func toStorageErr(err error) error {
|
||||
return errVolumeExists
|
||||
case errFileNotFound.Error():
|
||||
return errFileNotFound
|
||||
case errFileNameTooLong.Error():
|
||||
return errFileNameTooLong
|
||||
case errFileAccessDenied.Error():
|
||||
return errFileAccessDenied
|
||||
case errIsNotRegular.Error():
|
||||
return errIsNotRegular
|
||||
case errVolumeNotEmpty.Error():
|
||||
return errVolumeNotEmpty
|
||||
case errFileAccessDenied.Error():
|
||||
return errFileAccessDenied
|
||||
case errVolumeAccessDenied.Error():
|
||||
return errVolumeAccessDenied
|
||||
case errCorruptedFormat.Error():
|
||||
return errCorruptedFormat
|
||||
case errUnformattedDisk.Error():
|
||||
return errUnformattedDisk
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user