probe update and access command error messages update

This commit is contained in:
Anand Babu (AB) Periasamy
2015-08-19 23:22:39 -07:00
parent cc119a3b67
commit 754dc8849e
4 changed files with 17 additions and 9 deletions
+6 -3
View File
@@ -17,6 +17,8 @@
package main
import (
"errors"
"github.com/minio/mc/internal/github.com/minio/cli"
"github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
@@ -64,13 +66,14 @@ func mainAccess(ctx *cli.Context) {
config := mustGetMcConfig()
acl := bucketACL(ctx.Args().First())
if !acl.isValidBucketACL() {
fatalIf(probe.NewError(errInvalidACL{acl: acl.String()}), "ACL validation failed.")
fatalIf(probe.NewError(errors.New("")),
"Unrecognized permission ‘"+acl.String()+"’. Allowed values are [private, public, readonly].")
}
for _, arg := range ctx.Args().Tail() {
targetURL, err := getCanonicalizedURL(arg, config.Aliases)
fatalIf(err, "Unable to validate given URL.")
fatalIf(err, "Unable to parse URL argument ‘"+arg+"’.")
fatalIf(doUpdateAccessCmd(targetURL, acl), "Unable to set access permissions.")
fatalIf(doUpdateAccessCmd(targetURL, acl).Trace(), "Unable to set access permission ‘"+acl.String()+"’ for URL ‘"+targetURL+"’.")
}
}
@@ -137,11 +137,14 @@ func (e *Error) String() string {
if e.Cause != nil {
str := e.Cause.Error() + "\n"
for i, tp := range e.CallTrace {
if len(tp.Env) > 0 {
str += fmt.Sprintf(" (%d) %s:%d %s(..) Tags: [%s]\n", i, tp.Filename, tp.Line, tp.Function, strings.Join(tp.Env["Tags"], ", "))
callLen := len(e.CallTrace)
for i := callLen - 1; i >= 0; i-- {
if len(e.CallTrace[i].Env) > 0 {
str += fmt.Sprintf(" (%d) %s:%d %s(..) Tags: [%s]\n",
i, e.CallTrace[i].Filename, e.CallTrace[i].Line, e.CallTrace[i].Function, strings.Join(e.CallTrace[i].Env["Tags"], ", "))
} else {
str += fmt.Sprintf(" (%d) %s:%d %s(..)\n", i, tp.Filename, tp.Line, tp.Function)
str += fmt.Sprintf(" (%d) %s:%d %s(..)\n",
i, e.CallTrace[i].Filename, e.CallTrace[i].Line, e.CallTrace[i].Function)
}
}
+2 -2
View File
@@ -48,8 +48,8 @@
"canonical": "github.com/minio/minio/pkg/probe",
"comment": "",
"local": "github.com/minio/minio/pkg/probe",
"revision": "f223c8b36d4553962dd6a0ab587f2db82dc367f7",
"revisionTime": "2015-08-19T01:23:59-07:00"
"revision": "8463040cd19ca4c3d8642e28b0c5c11705f80746",
"revisionTime": "2015-08-19T22:44:29-07:00"
},
{
"canonical": "github.com/minio/minio/pkg/quick",
+2
View File
@@ -30,6 +30,7 @@ func (e errInvalidSessionID) Error() string {
return "Invalid session id ‘" + e.id + "’."
}
/*
type errInvalidACL struct {
acl string
}
@@ -37,6 +38,7 @@ type errInvalidACL struct {
func (e errInvalidACL) Error() string {
return "Invalid ACL Type ‘" + e.acl + "’. Valid types are [private, public, readonly]."
}
*/
type errNotAnObject struct {
url string