1
0
mirror of https://github.com/minio/mc.git synced 2025-07-28 20:01:58 +03:00

config: Provide meaningful errors for invalid URL and Alias. (#2233)

Fixes #2232
This commit is contained in:
Harshavardhana
2017-08-06 11:35:01 -07:00
committed by GitHub
parent e53ad24e8c
commit 60681d7fb6
4 changed files with 24 additions and 21 deletions

View File

@ -18,6 +18,8 @@ package cmd
import (
"errors"
"fmt"
"strings"
"github.com/minio/minio/pkg/probe"
)
@ -39,6 +41,21 @@ var (
return probe.NewError(errors.New("Use `mc config host add mycloud " + URL + " ...` to add an alias. Use the alias for S3 operations.")).Untrace()
}
errInvalidAlias = func(alias string) *probe.Error {
return probe.NewError(errors.New("Alias `" + alias + "` should have alphanumeric characters such as [helloWorld0, hello_World0, ...]"))
}
errInvalidURL = func(URL string) *probe.Error {
return probe.NewError(errors.New("URL `" + URL + "` for minio client should be of the form scheme://host[:port]/ without resource component."))
}
errInvalidAPISignature = func(api, url string) *probe.Error {
msg := fmt.Sprintf(
"Unrecognized API signature %s for host %s. Valid options are `[%s]`",
api, url, strings.Join(validAPIs, ", "))
return probe.NewError(errors.New(msg))
}
errNoMatchingHost = func(URL string) *probe.Error {
return probe.NewError(errors.New("No matching host found for the given URL `" + URL + "`.")).Untrace()
}