Merge pull request #1450 from harshavardhana/trace
trace: Add missing traces.
This commit is contained in:
+5
-5
@@ -52,7 +52,7 @@ func isTargetURLDir(targetURL string) bool {
|
||||
func getSource(sourceURL string) (reader io.ReadCloser, length int64, err *probe.Error) {
|
||||
sourceClnt, err := url2Client(sourceURL)
|
||||
if err != nil {
|
||||
return nil, 0, err.Trace()
|
||||
return nil, 0, err.Trace(sourceURL)
|
||||
}
|
||||
return sourceClnt.Get(0, 0)
|
||||
}
|
||||
@@ -127,7 +127,7 @@ func putTargets(targetURLs []string, length int64, reader io.Reader) *probe.Erro
|
||||
defer reader.Close()
|
||||
err := targetClient.Put(length, reader)
|
||||
if err != nil {
|
||||
errorCh <- err.Trace()
|
||||
errorCh <- err.Trace(targetClient.GetURL().String())
|
||||
return
|
||||
}
|
||||
}(tgtClient, tgtReader, errorCh)
|
||||
@@ -171,15 +171,15 @@ func getNewClient(urlStr string, auth hostConfig) (client.Client, *probe.Error)
|
||||
|
||||
s3Client, err := s3.New(s3Config)
|
||||
if err != nil {
|
||||
return nil, err.Trace()
|
||||
return nil, err.Trace(urlStr)
|
||||
}
|
||||
return s3Client, nil
|
||||
case client.Filesystem:
|
||||
fsClient, err := fs.New(urlStr)
|
||||
if err != nil {
|
||||
return nil, err.Trace()
|
||||
return nil, err.Trace(urlStr)
|
||||
}
|
||||
return fsClient, nil
|
||||
}
|
||||
return nil, errInitClient(urlStr).Trace()
|
||||
return nil, errInitClient(urlStr).Trace(urlStr)
|
||||
}
|
||||
|
||||
@@ -115,16 +115,16 @@ func checkConfigAliasSyntax(ctx *cli.Context) {
|
||||
cli.ShowCommandHelpAndExit(ctx, "alias", 1) // last argument is exit code
|
||||
}
|
||||
if len(ctx.Args().Tail()) > 2 {
|
||||
fatalIf(errDummy().Trace(), "Incorrect number of arguments to alias command")
|
||||
fatalIf(errDummy().Trace(ctx.Args().Tail()...), "Incorrect number of arguments to alias command")
|
||||
}
|
||||
switch strings.TrimSpace(ctx.Args().Get(0)) {
|
||||
case "add":
|
||||
if len(ctx.Args().Tail()) != 2 {
|
||||
fatalIf(errInvalidArgument().Trace(), "Incorrect number of arguments for add alias command.")
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), "Incorrect number of arguments for add alias command.")
|
||||
}
|
||||
case "remove":
|
||||
if len(ctx.Args().Tail()) != 1 {
|
||||
fatalIf(errInvalidArgument().Trace(), "Incorrect number of arguments for remove alias command.")
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), "Incorrect number of arguments for remove alias command.")
|
||||
}
|
||||
case "list":
|
||||
default:
|
||||
@@ -159,13 +159,13 @@ func removeAlias(alias string) {
|
||||
err = config.Load(configPath)
|
||||
fatalIf(err.Trace(configPath), "Unable to load config path")
|
||||
if !isValidAliasName(alias) {
|
||||
fatalIf(errDummy().Trace(), fmt.Sprintf("Alias name ‘%s’ is invalid, valid examples are: mybucket, Area51, Grand-Nagus", alias))
|
||||
fatalIf(errDummy().Trace(alias), fmt.Sprintf("Alias name ‘%s’ is invalid, valid examples are: mybucket, Area51, Grand-Nagus", alias))
|
||||
}
|
||||
|
||||
// convert interface{} back to its original struct
|
||||
newConf := config.Data().(*configV6)
|
||||
if _, ok := newConf.Aliases[alias]; !ok {
|
||||
fatalIf(errDummy().Trace(), fmt.Sprintf("Alias ‘%s’ does not exist.", alias))
|
||||
fatalIf(errDummy().Trace(alias), fmt.Sprintf("Alias ‘%s’ does not exist.", alias))
|
||||
}
|
||||
delete(newConf.Aliases, alias)
|
||||
|
||||
@@ -186,19 +186,19 @@ func addAlias(alias, url string) {
|
||||
fatalIf(err.Trace(globalMCConfigVersion), "Failed to initialize ‘quick’ configuration data structure.")
|
||||
|
||||
err = config.Load(mustGetMcConfigPath())
|
||||
fatalIf(err.Trace(), "Unable to load config path")
|
||||
fatalIf(err.Trace(mustGetMcConfigPath()), "Unable to load config path")
|
||||
|
||||
url = strings.TrimSuffix(url, "/")
|
||||
if !strings.HasPrefix(url, "http") {
|
||||
fatalIf(errDummy().Trace(), fmt.Sprintf("Invalid alias URL ‘%s’. Valid examples are: http://s3.amazonaws.com, https://yourbucket.example.com.", url))
|
||||
fatalIf(errDummy().Trace(url), fmt.Sprintf("Invalid alias URL ‘%s’. Valid examples are: http://s3.amazonaws.com, https://yourbucket.example.com.", url))
|
||||
}
|
||||
if !isValidAliasName(alias) {
|
||||
fatalIf(errDummy().Trace(), fmt.Sprintf("Alias name ‘%s’ is invalid, valid examples are: mybucket, Area51, Grand-Nagus", alias))
|
||||
fatalIf(errDummy().Trace(alias), fmt.Sprintf("Alias name ‘%s’ is invalid, valid examples are: mybucket, Area51, Grand-Nagus", alias))
|
||||
}
|
||||
// convert interface{} back to its original struct
|
||||
newConf := config.Data().(*configV6)
|
||||
if oldURL, ok := newConf.Aliases[alias]; ok {
|
||||
fatalIf(errDummy().Trace(), fmt.Sprintf("Alias ‘%s’ already exists for ‘%s’.", alias, oldURL))
|
||||
fatalIf(errDummy().Trace(alias), fmt.Sprintf("Alias ‘%s’ already exists for ‘%s’.", alias, oldURL))
|
||||
}
|
||||
newConf.Aliases[alias] = url
|
||||
newConfig, err := quick.New(newConf)
|
||||
|
||||
+4
-4
@@ -109,16 +109,16 @@ func checkConfigHostSyntax(ctx *cli.Context) {
|
||||
cli.ShowCommandHelpAndExit(ctx, "host", 1) // last argument is exit code
|
||||
}
|
||||
if len(ctx.Args().Tail()) > 4 {
|
||||
fatalIf(errDummy().Trace(), "Incorrect number of arguments to host command")
|
||||
fatalIf(errDummy().Trace(ctx.Args().Tail()...), "Incorrect number of arguments to host command")
|
||||
}
|
||||
switch strings.TrimSpace(ctx.Args().First()) {
|
||||
case "add":
|
||||
if len(ctx.Args().Tail()) < 3 || len(ctx.Args().Tail()) > 4 {
|
||||
fatalIf(errInvalidArgument().Trace(), "Incorrect number of arguments for add host command.")
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), "Incorrect number of arguments for add host command.")
|
||||
}
|
||||
case "remove":
|
||||
if len(ctx.Args().Tail()) != 1 {
|
||||
fatalIf(errInvalidArgument().Trace(), "Incorrect number of arguments for remove host command.")
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), "Incorrect number of arguments for remove host command.")
|
||||
}
|
||||
case "list":
|
||||
default:
|
||||
@@ -218,7 +218,7 @@ func addHost(newHostURL, accessKeyID, secretAccessKey, api string) {
|
||||
api = "S3v4"
|
||||
}
|
||||
if strings.TrimSpace(api) != "S3v2" && strings.TrimSpace(api) != "S3v4" {
|
||||
fatalIf(errInvalidArgument().Trace(), "Unrecognized version name provided, supported inputs are ‘S3v4’, ‘S3v2’.")
|
||||
fatalIf(errInvalidArgument().Trace(api), "Unrecognized version name provided, supported inputs are ‘S3v4’, ‘S3v2’.")
|
||||
}
|
||||
config, err := newConfig()
|
||||
fatalIf(err.Trace(globalMCConfigVersion), "Failed to initialize ‘quick’ configuration data structure.")
|
||||
|
||||
@@ -300,7 +300,7 @@ func fixConfigV6() {
|
||||
fatalIf(err.Trace(), "Unable to initialize config.")
|
||||
|
||||
err = config.Load(mustGetMcConfigPath())
|
||||
fatalIf(err.Trace(), "Unable to load config.")
|
||||
fatalIf(err.Trace(mustGetMcConfigPath()), "Unable to load config.")
|
||||
|
||||
if config.Data().(*configV6).Version == "6" {
|
||||
newConfig := new(configV6)
|
||||
|
||||
+5
-4
@@ -148,7 +148,7 @@ func doCopy(cpURLs copyURLs, progressReader *barSend, accountingReader *accounte
|
||||
if !globalQuietFlag && !globalJSONFlag {
|
||||
progressReader.ErrorGet(length)
|
||||
}
|
||||
cpURLs.Error = err.Trace()
|
||||
cpURLs.Error = err.Trace(cpURLs.SourceContent.URL.String())
|
||||
statusCh <- cpURLs
|
||||
return
|
||||
}
|
||||
@@ -178,7 +178,7 @@ func doCopy(cpURLs copyURLs, progressReader *barSend, accountingReader *accounte
|
||||
if !globalQuietFlag && !globalJSONFlag {
|
||||
progressReader.ErrorPut(length)
|
||||
}
|
||||
cpURLs.Error = err.Trace()
|
||||
cpURLs.Error = err.Trace(cpURLs.TargetContent.URL.String())
|
||||
statusCh <- cpURLs
|
||||
return
|
||||
}
|
||||
@@ -324,7 +324,8 @@ func doCopySession(session *sessionV5) {
|
||||
if !globalQuietFlag && !globalJSONFlag {
|
||||
console.Eraseline()
|
||||
}
|
||||
errorIf(cpURLs.Error.Trace(), fmt.Sprintf("Failed to copy ‘%s’.", cpURLs.SourceContent.URL.String()))
|
||||
errorIf(cpURLs.Error.Trace(cpURLs.SourceContent.URL.String()),
|
||||
fmt.Sprintf("Failed to copy ‘%s’.", cpURLs.SourceContent.URL.String()))
|
||||
// for all non critical errors we can continue for the remaining files
|
||||
switch cpURLs.Error.ToGoError().(type) {
|
||||
// handle this specifically for filesystem related errors.
|
||||
@@ -398,7 +399,7 @@ func mainCopy(ctx *cli.Context) {
|
||||
var err *probe.Error
|
||||
if session.Header.CommandArgs, err = args2URLs(ctx.Args()); err != nil {
|
||||
session.Delete()
|
||||
fatalIf(err.Trace(), "One or more unknown URL types passed.")
|
||||
fatalIf(err.Trace(ctx.Args()...), "One or more unknown URL types passed.")
|
||||
}
|
||||
|
||||
doCopySession(session)
|
||||
|
||||
@@ -93,7 +93,7 @@ func guessCopyURLType(sourceURLs []string, targetURL string, isRecursive bool) c
|
||||
func prepareCopyURLsTypeA(sourceURL string, targetURL string) copyURLs {
|
||||
if sourceURL == targetURL {
|
||||
// source and target can not be same
|
||||
return copyURLs{Error: errSourceTargetSame(sourceURL).Trace()}
|
||||
return copyURLs{Error: errSourceTargetSame(sourceURL).Trace(sourceURL)}
|
||||
}
|
||||
_, sourceContent, err := url2Stat(sourceURL)
|
||||
if err != nil {
|
||||
@@ -102,7 +102,7 @@ func prepareCopyURLsTypeA(sourceURL string, targetURL string) copyURLs {
|
||||
}
|
||||
if !sourceContent.Type.IsRegular() {
|
||||
// Source is not a regular file
|
||||
return copyURLs{Error: errInvalidSource(sourceURL).Trace()}
|
||||
return copyURLs{Error: errInvalidSource(sourceURL).Trace(sourceURL)}
|
||||
}
|
||||
// All OK.. We can proceed. Type A
|
||||
return makeCopyContentTypeA(sourceContent, targetURL)
|
||||
@@ -124,10 +124,10 @@ func prepareCopyURLsTypeB(sourceURL string, targetURL string) copyURLs {
|
||||
|
||||
if !sourceContent.Type.IsRegular() {
|
||||
if sourceContent.Type.IsDir() {
|
||||
return copyURLs{Error: errSourceIsDir(sourceURL).Trace()}
|
||||
return copyURLs{Error: errSourceIsDir(sourceURL).Trace(sourceURL)}
|
||||
}
|
||||
// Source is not a regular file.
|
||||
return copyURLs{Error: errInvalidSource(sourceURL).Trace()}
|
||||
return copyURLs{Error: errInvalidSource(sourceURL).Trace(sourceURL)}
|
||||
}
|
||||
|
||||
// All OK.. We can proceed. Type B: source is a file, target is a folder and exists.
|
||||
@@ -158,7 +158,7 @@ func prepareCopyURLsTypeC(sourceURL, targetURL string, isRecursive bool) <-chan
|
||||
for sourceContent := range sourceClient.List(isRecursive, false) {
|
||||
if sourceContent.Err != nil {
|
||||
// Listing failed.
|
||||
copyURLsCh <- copyURLs{Error: sourceContent.Err.Trace()}
|
||||
copyURLsCh <- copyURLs{Error: sourceContent.Err.Trace(sourceClient.GetURL().String())}
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ func prepareCopyURLs(sourceURLs []string, targetURL string, isRecursive bool) <-
|
||||
copyURLsCh <- cURLs
|
||||
}
|
||||
default:
|
||||
copyURLsCh <- copyURLs{Error: errInvalidArgument().Trace()}
|
||||
copyURLsCh <- copyURLs{Error: errInvalidArgument().Trace(sourceURLs...)}
|
||||
}
|
||||
}(sourceURLs, targetURL, copyURLsCh)
|
||||
|
||||
|
||||
+5
-4
@@ -70,7 +70,7 @@ func checkDiffSyntax(ctx *cli.Context) {
|
||||
}
|
||||
for _, arg := range ctx.Args() {
|
||||
if strings.TrimSpace(arg) == "" {
|
||||
fatalIf(errInvalidArgument().Trace(), "Unable to validate empty argument.")
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args()...), "Unable to validate empty argument.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ func (d diffMessage) String() string {
|
||||
msg = console.Colorize("DiffMessage",
|
||||
"‘"+d.FirstURL+"’"+" and "+"‘"+d.SecondURL+"’") + console.Colorize("DiffSize", " - differ in size.")
|
||||
default:
|
||||
fatalIf(errDummy().Trace(),
|
||||
fatalIf(errDummy().Trace(d.FirstURL, d.SecondURL),
|
||||
"Unhandled difference between ‘"+d.FirstURL+"’ and ‘"+d.SecondURL+"’.")
|
||||
}
|
||||
return msg
|
||||
@@ -132,7 +132,7 @@ func doDiffMain(firstURL, secondURL string) {
|
||||
}
|
||||
difference, err := objectDifferenceFactory(secondURL)
|
||||
if err != nil {
|
||||
fatalIf(err.Trace(secondURL), fmt.Sprintf("Failed to diff '%s' and '%s'", firstURL, secondURL))
|
||||
fatalIf(err.Trace(firstURL, secondURL), fmt.Sprintf("Failed to diff '%s' and '%s'", firstURL, secondURL))
|
||||
}
|
||||
isRecursive := true
|
||||
isIncomplete := false
|
||||
@@ -153,7 +153,8 @@ func doDiffMain(firstURL, secondURL string) {
|
||||
suffix := strings.TrimPrefix(sourceContent.URL.String(), firstURL)
|
||||
differ, err := difference(suffix, sourceContent.Type, sourceContent.Size)
|
||||
if err != nil {
|
||||
errorIf(sourceContent.Err.Trace(), fmt.Sprintf("Failed on '%s'", urlJoinPath(secondURL, suffix)))
|
||||
errorIf(sourceContent.Err.Trace(secondURL, suffix),
|
||||
fmt.Sprintf("Failed on '%s'", urlJoinPath(secondURL, suffix)))
|
||||
continue
|
||||
}
|
||||
if differ == differNone {
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ type hostConfig struct {
|
||||
func getHostConfig(URL string) (hostConfig, *probe.Error) {
|
||||
config, err := getMcConfig()
|
||||
if err != nil {
|
||||
return hostConfig{}, err.Trace()
|
||||
return hostConfig{}, err.Trace(URL)
|
||||
}
|
||||
url := client.NewURL(URL)
|
||||
// No host matching or keys needed for filesystem requests.
|
||||
@@ -58,5 +58,5 @@ func getHostConfig(URL string) (hostConfig, *probe.Error) {
|
||||
}
|
||||
}
|
||||
// return error if cannot be matched.
|
||||
return hostConfig{}, errNoMatchingHost(URL).Trace()
|
||||
return hostConfig{}, errNoMatchingHost(URL).Trace(URL)
|
||||
}
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ func checkListSyntax(ctx *cli.Context) {
|
||||
}
|
||||
for _, arg := range args {
|
||||
if strings.TrimSpace(arg) == "" {
|
||||
fatalIf(errInvalidArgument().Trace(), "Unable to validate empty argument.")
|
||||
fatalIf(errInvalidArgument().Trace(args...), "Unable to validate empty argument.")
|
||||
}
|
||||
}
|
||||
// extract URLs.
|
||||
|
||||
@@ -117,19 +117,19 @@ func doList(clnt client.Client, isRecursive, isIncomplete bool) *probe.Error {
|
||||
switch content.Err.ToGoError().(type) {
|
||||
// handle this specifically for filesystem related errors.
|
||||
case client.BrokenSymlink:
|
||||
errorIf(content.Err.Trace(), "Unable to list broken link.")
|
||||
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list broken link.")
|
||||
continue
|
||||
case client.TooManyLevelsSymlink:
|
||||
errorIf(content.Err.Trace(), "Unable to list too many levels link.")
|
||||
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list too many levels link.")
|
||||
continue
|
||||
case client.PathNotFound:
|
||||
errorIf(content.Err.Trace(), "Unable to list folder.")
|
||||
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.")
|
||||
continue
|
||||
case client.PathInsufficientPermission:
|
||||
errorIf(content.Err.Trace(), "Unable to list folder.")
|
||||
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.")
|
||||
continue
|
||||
}
|
||||
errorIf(content.Err.Trace(), "Unable to list folder.")
|
||||
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.")
|
||||
continue
|
||||
}
|
||||
contentURL := content.URL.Path
|
||||
|
||||
+6
-5
@@ -77,13 +77,14 @@ func checkMirrorSyntax(ctx *cli.Context) {
|
||||
url := client.NewURL(tgtURL)
|
||||
if url.Host != "" {
|
||||
if url.Path == string(url.Separator) {
|
||||
fatalIf(errInvalidArgument().Trace(), fmt.Sprintf("Target ‘%s’ does not contain bucket name.", tgtURL))
|
||||
fatalIf(errInvalidArgument().Trace(tgtURL),
|
||||
fmt.Sprintf("Target ‘%s’ does not contain bucket name.", tgtURL))
|
||||
}
|
||||
}
|
||||
_, _, err = url2Stat(tgtURL)
|
||||
// we die on any error other than client.PathNotFound - destination directory need not exist.
|
||||
if _, ok := err.ToGoError().(client.PathNotFound); !ok {
|
||||
fatalIf(err.Trace(), fmt.Sprintf("Unable to stat %s", tgtURL))
|
||||
fatalIf(err.Trace(tgtURL), fmt.Sprintf("Unable to stat %s", tgtURL))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +111,7 @@ func deltaSourceTargets(sourceURL string, targetURLs []string, isForce bool, mir
|
||||
var err *probe.Error
|
||||
objectDifferenceArray[i], err = objectDifferenceFactory(targetURLs[i])
|
||||
if err != nil {
|
||||
mirrorURLsCh <- mirrorURLs{Error: err.Trace()}
|
||||
mirrorURLsCh <- mirrorURLs{Error: err.Trace(targetURLs...)}
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -123,7 +124,7 @@ func deltaSourceTargets(sourceURL string, targetURLs []string, isForce bool, mir
|
||||
|
||||
for sourceContent := range sourceClient.List(true, false) {
|
||||
if sourceContent.Err != nil {
|
||||
mirrorURLsCh <- mirrorURLs{Error: sourceContent.Err.Trace()}
|
||||
mirrorURLsCh <- mirrorURLs{Error: sourceContent.Err.Trace(sourceClient.GetURL().String())}
|
||||
continue
|
||||
}
|
||||
if sourceContent.Type.IsDir() {
|
||||
@@ -134,7 +135,7 @@ func deltaSourceTargets(sourceURL string, targetURLs []string, isForce bool, mir
|
||||
for i, difference := range objectDifferenceArray {
|
||||
differ, err := difference(suffix, sourceContent.Type, sourceContent.Size)
|
||||
if err != nil {
|
||||
mirrorURLsCh <- mirrorURLs{Error: err.Trace()}
|
||||
mirrorURLsCh <- mirrorURLs{Error: err.Trace(sourceContent.URL.String())}
|
||||
continue
|
||||
}
|
||||
if differ == differNone {
|
||||
|
||||
+2
-2
@@ -63,7 +63,7 @@ EXAMPLES:
|
||||
|
||||
// pipe writes contents of stdin a collection of URLs.
|
||||
func pipe(targetURLs []string) *probe.Error {
|
||||
if len(targetURLs) == 0 {
|
||||
if len(targetURLs) == 0 || targetURLs == nil {
|
||||
// When no target is specified, pipe cat's stdin to stdout.
|
||||
return catOut(os.Stdin).Trace()
|
||||
}
|
||||
@@ -80,7 +80,7 @@ func pipe(targetURLs []string) *probe.Error {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return err.Trace()
|
||||
return err.Trace(targetURLs...)
|
||||
}
|
||||
|
||||
// mainPipe is the main entry point for pipe command.
|
||||
|
||||
+5
-5
@@ -87,7 +87,7 @@ func listSessions() *probe.Error {
|
||||
for _, sid := range getSessionIDs() {
|
||||
s, err := loadSessionV5(sid)
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
return err.Trace(sid)
|
||||
}
|
||||
bySessions = append(bySessions, s)
|
||||
}
|
||||
@@ -134,7 +134,7 @@ func clearSession(sid string) {
|
||||
}
|
||||
|
||||
if !isSessionExists(sid) {
|
||||
fatalIf(errDummy().Trace(), "Session ‘"+sid+"’ not found.")
|
||||
fatalIf(errDummy().Trace(sid), "Session ‘"+sid+"’ not found.")
|
||||
}
|
||||
|
||||
session, err := loadSessionV5(sid)
|
||||
@@ -167,11 +167,11 @@ func checkSessionSyntax(ctx *cli.Context) {
|
||||
case "list":
|
||||
case "resume":
|
||||
if strings.TrimSpace(ctx.Args().Tail().First()) == "" {
|
||||
fatalIf(errInvalidArgument().Trace(), "Unable to validate empty argument.")
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args()...), "Unable to validate empty argument.")
|
||||
}
|
||||
case "clear":
|
||||
if strings.TrimSpace(ctx.Args().Tail().First()) == "" {
|
||||
fatalIf(errInvalidArgument().Trace(), "Unable to validate empty argument.")
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args()...), "Unable to validate empty argument.")
|
||||
}
|
||||
default:
|
||||
cli.ShowCommandHelpAndExit(ctx, "session", 1) // last argument is exit code
|
||||
@@ -208,7 +208,7 @@ func mainSession(ctx *cli.Context) {
|
||||
switch strings.TrimSpace(ctx.Args().First()) {
|
||||
// list all resumable sessions.
|
||||
case "list":
|
||||
fatalIf(listSessions().Trace(), "Unable to list sessions.")
|
||||
fatalIf(listSessions().Trace(ctx.Args()...), "Unable to list sessions.")
|
||||
case "resume":
|
||||
sid := strings.TrimSpace(ctx.Args().Tail().First())
|
||||
if !isSessionExists(sid) {
|
||||
|
||||
+2
-2
@@ -96,7 +96,7 @@ func (s *shareDBV1) Load(filename string) *probe.Error {
|
||||
// Initialize and load using quick package.
|
||||
qs, err := quick.New(newShareDBV1())
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
return err.Trace(filename)
|
||||
}
|
||||
err = qs.Load(filename)
|
||||
if err != nil {
|
||||
@@ -120,7 +120,7 @@ func (s shareDBV1) save(filename string) *probe.Error {
|
||||
// Initialize a new quick file.
|
||||
qs, err := quick.New(s)
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
return err.Trace(filename)
|
||||
}
|
||||
return qs.Save(filename).Trace(filename)
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ func checkShareDownloadSyntax(ctx *cli.Context) {
|
||||
func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration) *probe.Error {
|
||||
clnt, err := url2Client(targetURL)
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
return err.Trace(targetURL)
|
||||
}
|
||||
|
||||
// Load previously saved upload-shares. Add new entries and write it back.
|
||||
@@ -109,7 +109,7 @@ func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration
|
||||
shareDownloadsFile := getShareDownloadsFile()
|
||||
err = shareDB.Load(shareDownloadsFile)
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
return err.Trace(shareDownloadsFile)
|
||||
}
|
||||
|
||||
// Generate share URL for each target.
|
||||
|
||||
@@ -133,13 +133,13 @@ func saveSharedURL(objectURL string, shareURL string, expiry time.Duration, cont
|
||||
func doShareUploadURL(objectURL string, recursive bool, expiry time.Duration, contentType string) *probe.Error {
|
||||
clnt, err := url2Client(objectURL)
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
return err.Trace(objectURL)
|
||||
}
|
||||
|
||||
// Generate pre-signed access info.
|
||||
uploadInfo, err := clnt.ShareUpload(recursive, expiry, contentType)
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
return err.Trace(objectURL, "expiry="+expiry.String(), "contentType="+contentType)
|
||||
}
|
||||
|
||||
// Generate curl command.
|
||||
|
||||
@@ -174,21 +174,21 @@ func initShareDownloadsFile() *probe.Error {
|
||||
func initShareConfig() {
|
||||
// Share directory.
|
||||
if !isShareDirExists() {
|
||||
fatalIf(createShareDir().Trace(),
|
||||
fatalIf(createShareDir().Trace(mustGetShareDir()),
|
||||
"Failed to create share ‘"+mustGetShareDir()+"’ folder.")
|
||||
console.Infof("Successfully created ‘%s’.\n", mustGetShareDir())
|
||||
}
|
||||
|
||||
// Uploads share file.
|
||||
if !isShareUploadsExists() {
|
||||
fatalIf(initShareUploadsFile().Trace(),
|
||||
fatalIf(initShareUploadsFile().Trace(getShareUploadsFile()),
|
||||
"Failed to initialize share uploads ‘"+getShareUploadsFile()+"’ file.")
|
||||
console.Infof("Initialized share uploads ‘%s’ file.\n", getShareUploadsFile())
|
||||
}
|
||||
|
||||
// Downloads share file.
|
||||
if !isShareDownloadsExists() {
|
||||
fatalIf(initShareDownloadsFile().Trace(),
|
||||
fatalIf(initShareDownloadsFile().Trace(getShareDownloadsFile()),
|
||||
"Failed to initialize share downloads ‘"+getShareDownloadsFile()+"’ file.")
|
||||
console.Infof("Initialized share downloads ‘%s’ file.\n", getShareDownloadsFile())
|
||||
}
|
||||
|
||||
+2
-2
@@ -127,7 +127,7 @@ func getReleaseUpdate(updateURL string) {
|
||||
fatalIf(probe.NewError(e), "Unable to parse version string as time.")
|
||||
|
||||
if current.IsZero() {
|
||||
fatalIf(errDummy().Trace(),
|
||||
fatalIf(errDummy().Trace(mcVersion),
|
||||
"Updates not supported for custom builds. Version field is empty. Please download official releases from https://minio.io/#mc")
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ func getReleaseUpdate(updateURL string) {
|
||||
}
|
||||
|
||||
if latest.IsZero() {
|
||||
fatalIf(errDummy().Trace(),
|
||||
fatalIf(errDummy().Trace(mcVersion),
|
||||
"Unable to validate any update available at this time. Please open an issue at https://github.com/minio/mc/issues")
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ func checkGolangRuntimeVersion() {
|
||||
v1 := newVersion(getNormalizedGolangVersion())
|
||||
v2 := newVersion(minGolangRuntimeVersion)
|
||||
if v1.LessThan(v2) {
|
||||
fatalIf(errDummy().Trace(),
|
||||
fatalIf(errDummy().Trace(getNormalizedGolangVersion(), minGolangRuntimeVersion),
|
||||
"Old Golang runtime version ‘"+v1.String()+"’ detected., ‘mc’ requires minimum go1.5.1 or later.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user