From 754dc8849e511927b7dd06d71ff893bbf1e9ef31 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Wed, 19 Aug 2015 23:22:39 -0700 Subject: [PATCH] probe update and access command error messages update --- access-main.go | 9 ++++++--- internal/github.com/minio/minio/pkg/probe/probe.go | 11 +++++++---- internal/vendor.json | 4 ++-- typed-errors.go | 2 ++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/access-main.go b/access-main.go index a74c4abf..e99f0bb9 100644 --- a/access-main.go +++ b/access-main.go @@ -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+"’.") } } diff --git a/internal/github.com/minio/minio/pkg/probe/probe.go b/internal/github.com/minio/minio/pkg/probe/probe.go index 666cde77..ee1e4886 100644 --- a/internal/github.com/minio/minio/pkg/probe/probe.go +++ b/internal/github.com/minio/minio/pkg/probe/probe.go @@ -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) } } diff --git a/internal/vendor.json b/internal/vendor.json index 8812573a..e7ea96f8 100755 --- a/internal/vendor.json +++ b/internal/vendor.json @@ -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", diff --git a/typed-errors.go b/typed-errors.go index 0c6a6b8a..e66a6df9 100644 --- a/typed-errors.go +++ b/typed-errors.go @@ -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