mirror of
https://github.com/minio/minio.git
synced 2024-12-25 14:45:54 -05:00
xl: Print the correct err msg when access to the backend is forbidden (#8735)
minio server /data{1..4} shows an error about inability to bind a port, though the real problem is /data{1..4} cannot be created because of the lack of permissions. This commit fix the behavior.
This commit is contained in:
parent
dd311623df
commit
d861edfc00
@ -20,7 +20,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"net"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/minio/minio/pkg/color"
|
"github.com/minio/minio/pkg/color"
|
||||||
@ -106,9 +106,11 @@ func ErrorToErr(err error) Err {
|
|||||||
// Show a generic message for known golang errors
|
// Show a generic message for known golang errors
|
||||||
if errors.Is(err, syscall.EADDRINUSE) {
|
if errors.Is(err, syscall.EADDRINUSE) {
|
||||||
return ErrPortAlreadyInUse(err).Msg("Specified port is already in use")
|
return ErrPortAlreadyInUse(err).Msg("Specified port is already in use")
|
||||||
} else if errors.Is(err, syscall.EACCES) {
|
} else if errors.Is(err, syscall.EACCES) || errors.Is(err, syscall.EPERM) {
|
||||||
return ErrPortAccess(err).Msg("Insufficient permissions to use specified port")
|
switch err.(type) {
|
||||||
} else if os.IsPermission(err) {
|
case *net.OpError:
|
||||||
|
return ErrPortAccess(err).Msg("Insufficient permissions to use specified port")
|
||||||
|
}
|
||||||
return ErrNoPermissionsToAccessDirFiles(err).Msg("Insufficient permissions to access path")
|
return ErrNoPermissionsToAccessDirFiles(err).Msg("Insufficient permissions to access path")
|
||||||
} else if errors.Is(err, io.ErrUnexpectedEOF) {
|
} else if errors.Is(err, io.ErrUnexpectedEOF) {
|
||||||
return ErrUnexpectedDataContent(err)
|
return ErrUnexpectedDataContent(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user