errors: Add missing ending dot in error & fatal messages (#2418)
This commit is contained in:
committed by
Nitish Tiwari
parent
ae3c123a5c
commit
45b32d3985
@@ -75,7 +75,7 @@ func mainAdminCreds(ctx *cli.Context) error {
|
||||
|
||||
// Change the credentials of the specified Minio server
|
||||
e := client.SetCredentials(accessKey, secretKey)
|
||||
fatalIf(probe.NewError(e), "Unable to set new credentials to '"+aliasedURL+"'")
|
||||
fatalIf(probe.NewError(e), "Unable to set new credentials to '"+aliasedURL+"'.")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ func (ui *uiData) printItemsJSON(s *madmin.HealTaskStatus) (err error) {
|
||||
return err
|
||||
}
|
||||
jsonBytes, err := json.Marshal(r)
|
||||
fatalIf(probe.NewError(err), "Unable to marshal to JSON")
|
||||
fatalIf(probe.NewError(err), "Unable to marshal to JSON.")
|
||||
console.Println(string(jsonBytes))
|
||||
}
|
||||
return nil
|
||||
@@ -327,7 +327,7 @@ func (ui *uiData) printStatsJSON(s *madmin.HealTaskStatus) {
|
||||
summary.ElapsedTime = int64(ui.HealDuration.Round(time.Second).Seconds())
|
||||
|
||||
jBytes, err := json.Marshal(summary)
|
||||
fatalIf(probe.NewError(err), "Unable to marshal to JSON")
|
||||
fatalIf(probe.NewError(err), "Unable to marshal to JSON.")
|
||||
console.Println(string(jBytes))
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -243,7 +243,7 @@ func mainCat(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
encKeyDB, err := parseAndValidateEncryptionKeys(sseKeys)
|
||||
fatalIf(err, "Unable to parse encryption keys")
|
||||
fatalIf(err, "Unable to parse encryption keys.")
|
||||
// Convert arguments to URLs: expand alias, fix format.
|
||||
for _, url := range args {
|
||||
fatalIf(catURL(url, encKeyDB).Trace(url), "Unable to read from `"+url+"`.")
|
||||
|
||||
+1
-1
@@ -137,7 +137,7 @@ func loadRootCAs() {
|
||||
for _, caFile := range caFiles {
|
||||
caCert, err := ioutil.ReadFile(caFile)
|
||||
if err != nil {
|
||||
fatalIf(probe.NewError(err), "Unable to load a CA file")
|
||||
fatalIf(probe.NewError(err), "Unable to load a CA file.")
|
||||
}
|
||||
globalRootCAs.AppendCertsFromPEM(caCert)
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func checkConfigHostAddSyntax(ctx *cli.Context) {
|
||||
api := ctx.String("api")
|
||||
bucketLookup := ctx.String("lookup")
|
||||
if !isValidAlias(alias) {
|
||||
fatalIf(errInvalidAlias(alias), "Invalid alias")
|
||||
fatalIf(errInvalidAlias(alias), "Invalid alias.")
|
||||
}
|
||||
|
||||
if !isValidHostURL(url) {
|
||||
@@ -231,7 +231,7 @@ func mainConfigHostAdd(ctx *cli.Context) error {
|
||||
)
|
||||
|
||||
s3Config, err := buildS3Config(url, accessKey, secretKey, api, lookup)
|
||||
fatalIf(err.Trace(ctx.Args()...), "Unable to initialize new config from the provided credentials")
|
||||
fatalIf(err.Trace(ctx.Args()...), "Unable to initialize new config from the provided credentials.")
|
||||
|
||||
addHost(ctx.Args().Get(0), hostConfigV9{
|
||||
URL: s3Config.HostURL,
|
||||
|
||||
@@ -134,7 +134,7 @@ func listHosts(alias string) {
|
||||
})
|
||||
return
|
||||
}
|
||||
fatalIf(errInvalidAliasedURL(alias), "No such alias `"+alias+"` found")
|
||||
fatalIf(errInvalidAliasedURL(alias), "No such alias `"+alias+"` found.")
|
||||
}
|
||||
|
||||
var hosts []hostMessage
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ func doPrepareCopyURLs(session *sessionV8, trapCh <-chan bool, cancelCopy contex
|
||||
newerThan := session.Header.CommandIntFlags["newer-than"]
|
||||
encryptKeys := session.Header.CommandStringFlags["encrypt-key"]
|
||||
encKeyDB, err := parseAndValidateEncryptionKeys(encryptKeys)
|
||||
fatalIf(err, "Unable to parse encryption keys")
|
||||
fatalIf(err, "Unable to parse encryption keys.")
|
||||
// Create a session data file to store the processed URLs.
|
||||
dataFP := session.NewDataWriter()
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func checkEventsRemoveSyntax(ctx *cli.Context) {
|
||||
cli.ShowCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code
|
||||
}
|
||||
if len(ctx.Args()) == 1 && !ctx.Bool("force") {
|
||||
fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all bucket notifications")
|
||||
fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all bucket notifications.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -70,7 +70,7 @@ func (f findMessage) JSON() string {
|
||||
//
|
||||
func nameMatch(pattern, path string) bool {
|
||||
matched, e := filepath.Match(pattern, filepath.Base(path))
|
||||
errorIf(probe.NewError(e).Trace(pattern, path), "Unable to match with input pattern")
|
||||
errorIf(probe.NewError(e).Trace(pattern, path), "Unable to match with input pattern.")
|
||||
if !matched {
|
||||
for _, pathComponent := range strings.Split(path, "/") {
|
||||
matched = pathComponent == pattern
|
||||
@@ -94,7 +94,7 @@ func pathMatch(pattern, path string) bool {
|
||||
// regexMatch reports whether path matches the regex pattern.
|
||||
func regexMatch(pattern, path string) bool {
|
||||
matched, e := regexp.MatchString(pattern, path)
|
||||
errorIf(probe.NewError(e).Trace(pattern), "Unable to regex match with input pattern")
|
||||
errorIf(probe.NewError(e).Trace(pattern), "Unable to regex match with input pattern.")
|
||||
return matched
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ func watchFind(ctx *findContext) {
|
||||
events: []string{"put"},
|
||||
}
|
||||
watchObj, err := ctx.clnt.Watch(params)
|
||||
fatalIf(err.Trace(ctx.targetAlias), "Cannot watch with given params")
|
||||
fatalIf(err.Trace(ctx.targetAlias), "Cannot watch with given params.")
|
||||
|
||||
// Enables users to kill using the control + c
|
||||
trapCh := signalTrap(os.Interrupt, syscall.SIGTERM)
|
||||
@@ -160,7 +160,7 @@ func watchFind(ctx *findContext) {
|
||||
|
||||
time, e := time.Parse(time.RFC3339, event.Time)
|
||||
if e != nil {
|
||||
errorIf(probe.NewError(e).Trace(event.Time), "Unable to parse event time")
|
||||
errorIf(probe.NewError(e).Trace(event.Time), "Unable to parse event time.")
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ var defaultSevenDays = time.Duration(604800) * time.Second
|
||||
// argument to generate and return presigned URLs, returns error if any.
|
||||
func getShareURL(path string) string {
|
||||
targetAlias, targetURLFull, _, err := expandAlias(path)
|
||||
fatalIf(err.Trace(path), "Unable to expand alias")
|
||||
fatalIf(err.Trace(path), "Unable to expand alias.")
|
||||
|
||||
clnt, err := newClientFromAlias(targetAlias, targetURLFull)
|
||||
fatalIf(err.Trace(targetAlias, targetURLFull), "Unable to initialize client instance from alias.")
|
||||
|
||||
+8
-8
@@ -579,7 +579,7 @@ func (mj *mirrorJob) mirror(ctx context.Context, cancelMirror context.CancelFunc
|
||||
PathInsufficientPermission, ObjectOnGlacier:
|
||||
continue
|
||||
case deleteNotAllowedErr, overwriteNotAllowedErr:
|
||||
errorIf(err, "Unable to perform a mirror action")
|
||||
errorIf(err, "Unable to perform a mirror action.")
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -671,13 +671,13 @@ func runMirror(srcURL, dstURL string, ctx *cli.Context, encKeyDB map[string][]pr
|
||||
encKeyDB)
|
||||
|
||||
srcClt, err := newClient(srcURL)
|
||||
fatalIf(err, "Unable to initialize `"+srcURL+"`")
|
||||
fatalIf(err, "Unable to initialize `"+srcURL+"`.")
|
||||
|
||||
dstClt, err := newClient(dstURL)
|
||||
fatalIf(err, "Unable to initialize `"+srcURL+"`")
|
||||
fatalIf(err, "Unable to initialize `"+srcURL+"`.")
|
||||
|
||||
if ctx.Bool("a") && (srcClt.GetURL().Type != objectStorage || dstClt.GetURL().Type != objectStorage) {
|
||||
fatalIf(errDummy(), "Synchronizing bucket policies is only possible when both source & target point to S3 servers")
|
||||
fatalIf(errDummy(), "Synchronizing bucket policies is only possible when both source & target point to S3 servers.")
|
||||
}
|
||||
|
||||
mirrorAllBuckets := (srcClt.GetURL().Type == objectStorage && srcClt.GetURL().Path == "/") ||
|
||||
@@ -704,13 +704,13 @@ func runMirror(srcURL, dstURL string, ctx *cli.Context, encKeyDB map[string][]pr
|
||||
if d.Diff == differInFirst {
|
||||
// Bucket only exists in the source, create the same bucket in the destination
|
||||
if err := newDstClt.MakeBucket(ctx.String("region"), false); err != nil {
|
||||
errorIf(err, "Cannot created bucket in `"+newTgtURL+"`")
|
||||
errorIf(err, "Cannot created bucket in `"+newTgtURL+"`.")
|
||||
continue
|
||||
}
|
||||
// Copy policy rules from source to dest if flag is activated
|
||||
if ctx.Bool("a") {
|
||||
if err := copyBucketPolicies(srcClt, dstClt, isOverwrite); err != nil {
|
||||
errorIf(err, "Cannot copy bucket policies to `"+newDstClt.GetURL().String()+"`")
|
||||
errorIf(err, "Cannot copy bucket policies to `"+newDstClt.GetURL().String()+"`.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -759,10 +759,10 @@ func mainMirror(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
encKeyDB, err := parseAndValidateEncryptionKeys(sseKeys)
|
||||
fatalIf(err, "Unable to parse encryption keys")
|
||||
fatalIf(err, "Unable to parse encryption keys.")
|
||||
|
||||
if err := runMirror(srcURL, tgtURL, ctx, encKeyDB); err != nil {
|
||||
errorIf(err.Trace(srcURL, tgtURL), "Unable to mirror")
|
||||
errorIf(err.Trace(srcURL, tgtURL), "Unable to mirror.")
|
||||
return exitStatus(globalErrorExitStatus)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ func mainPipe(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
encKeyDB, err := parseAndValidateEncryptionKeys(sseKeys)
|
||||
fatalIf(err, "Unable to parse encryption keys")
|
||||
fatalIf(err, "Unable to parse encryption keys.")
|
||||
err = pipe(URLs[0], encKeyDB)
|
||||
fatalIf(err.Trace(URLs[0]), "Unable to write to one or more targets.")
|
||||
}
|
||||
|
||||
+1
-1
@@ -327,7 +327,7 @@ func runPolicyLinksCmd(ctx *cli.Context) {
|
||||
|
||||
// Encode public URL
|
||||
u, e := url.Parse(content.URL.String())
|
||||
errorIf(probe.NewError(e), "Unable to parse url `"+content.URL.String()+"`")
|
||||
errorIf(probe.NewError(e), "Unable to parse url `"+content.URL.String()+"`.")
|
||||
publicURL := u.String()
|
||||
|
||||
// Construct the message to be displayed to the user
|
||||
|
||||
+1
-1
@@ -337,7 +337,7 @@ func mainRm(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
encKeyDB, perr := parseAndValidateEncryptionKeys(sseKeys)
|
||||
fatalIf(perr, "Unable to parse encryption keys")
|
||||
fatalIf(perr, "Unable to parse encryption keys.")
|
||||
// Set color.
|
||||
console.SetColor("Remove", color.New(color.FgGreen, color.Bold))
|
||||
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ func mainStat(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
encKeyDB, err := parseAndValidateEncryptionKeys(sseKeys)
|
||||
fatalIf(err, "Unable to parse encryption keys")
|
||||
fatalIf(err, "Unable to parse encryption keys.")
|
||||
|
||||
var cErr error
|
||||
for _, targetURL := range args {
|
||||
|
||||
+2
-2
@@ -134,7 +134,7 @@ func isDocker(cgroupFile string) (bool, *probe.Error) {
|
||||
// IsDocker - returns if the environment is docker or not.
|
||||
func IsDocker() bool {
|
||||
found, err := isDocker("/proc/self/cgroup")
|
||||
fatalIf(err.Trace("/proc/self/cgroup"), "Unable to validate if this is a docker container")
|
||||
fatalIf(err.Trace("/proc/self/cgroup"), "Unable to validate if this is a docker container.")
|
||||
return found
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ func mainUpdate(ctx *cli.Context) {
|
||||
console.SetColor("Update", color.New(color.FgGreen, color.Bold))
|
||||
|
||||
older, downloadURL, err := getUpdateInfo(10 * time.Second)
|
||||
fatalIf(err.Trace(downloadURL), "Unable to fetch update info for mc")
|
||||
fatalIf(err.Trace(downloadURL), "Unable to fetch update info for mc.")
|
||||
|
||||
if !globalQuiet {
|
||||
printMsg(updateMessage{
|
||||
|
||||
Reference in New Issue
Block a user