final review of all error messages
This commit is contained in:
@@ -70,7 +70,7 @@ func getMcConfigDir() (string, *probe.Error) {
|
||||
// mustGetMcConfigDir - construct minio client config folder or fail
|
||||
func mustGetMcConfigDir() (configDir string) {
|
||||
configDir, err := getMcConfigDir()
|
||||
fatalIf(err.Trace(), "Unable to get mcConfigDir")
|
||||
fatalIf(err.Trace(), "Unable to get mcConfigDir.")
|
||||
|
||||
return configDir
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func getMcConfigPath() (string, *probe.Error) {
|
||||
// mustGetMcConfigPath - similar to getMcConfigPath, ignores errors
|
||||
func mustGetMcConfigPath() string {
|
||||
path, err := getMcConfigPath()
|
||||
fatalIf(err.Trace(), "Unable to get mcConfigPath")
|
||||
fatalIf(err.Trace(), "Unable to get mcConfigPath.")
|
||||
|
||||
return path
|
||||
}
|
||||
@@ -138,7 +138,7 @@ func getMcConfig() (*configV2, *probe.Error) {
|
||||
// mustGetMcConfig - reads configuration file and returns configs, exits on error
|
||||
func mustGetMcConfig() *configV2 {
|
||||
config, err := getMcConfig()
|
||||
fatalIf(err.Trace(), "Unable to get mcConfig")
|
||||
fatalIf(err.Trace(), "Unable to get mcConfig.")
|
||||
|
||||
return config
|
||||
}
|
||||
@@ -186,7 +186,7 @@ func migrateConfigV1ToV101() {
|
||||
return
|
||||
}
|
||||
mcConfigV1, err := quick.Load(mustGetMcConfigPath(), newConfigV1())
|
||||
fatalIf(err.Trace(), "Unable to load config")
|
||||
fatalIf(err.Trace(), "Unable to load config.")
|
||||
|
||||
// update to newer version
|
||||
if mcConfigV1.Version() == "1.0.0" {
|
||||
@@ -212,12 +212,12 @@ func migrateConfigV1ToV101() {
|
||||
}
|
||||
|
||||
mcNewConfigV101, err := quick.New(confV101)
|
||||
fatalIf(err.Trace(), "Unable to initialize quick config")
|
||||
fatalIf(err.Trace(), "Unable to initialize quick config.")
|
||||
|
||||
err = mcNewConfigV101.Save(mustGetMcConfigPath())
|
||||
fatalIf(err.Trace(), "Unable to save config")
|
||||
fatalIf(err.Trace(), "Unable to save config.")
|
||||
|
||||
console.Infof("Successfully migrated %s from version: 1.0.0 to version: 1.0.1\n", mustGetMcConfigPath())
|
||||
console.Infof("Successfully migrated %s from version ‘1.0.0’ to version ‘1.0.1’.\n", mustGetMcConfigPath())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ func migrateConfigV101ToV2() {
|
||||
return
|
||||
}
|
||||
mcConfigV101, err := quick.Load(mustGetMcConfigPath(), newConfigV101())
|
||||
fatalIf(err.Trace(), "Unable to load config")
|
||||
fatalIf(err.Trace(), "Unable to load config.")
|
||||
|
||||
// update to newer version
|
||||
if mcConfigV101.Version() == "1.0.1" {
|
||||
@@ -234,12 +234,12 @@ func migrateConfigV101ToV2() {
|
||||
confV2.Version = globalMCConfigVersion
|
||||
|
||||
mcNewConfigV2, err := quick.New(confV2)
|
||||
fatalIf(err.Trace(), "Unable to initialize quick config")
|
||||
fatalIf(err.Trace(), "Unable to initialize quick config.")
|
||||
|
||||
err = mcNewConfigV2.Save(mustGetMcConfigPath())
|
||||
fatalIf(err.Trace(), "Unable to save config")
|
||||
fatalIf(err.Trace(), "Unable to save config.")
|
||||
|
||||
console.Infof("Successfully migrated %s from version: 1.0.1 to version: 2\n", mustGetMcConfigPath())
|
||||
console.Infof("Successfully migrated %s from version ‘1.0.1’ to version: ‘2’.\n", mustGetMcConfigPath())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func fatalIf(err *probe.Error, msg string) {
|
||||
}
|
||||
json, err := json.Marshal(errorMessage)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
console.Fatalln(probe.NewError(err))
|
||||
}
|
||||
console.Println(string(json))
|
||||
os.Exit(1)
|
||||
@@ -82,7 +82,7 @@ func errorIf(err *probe.Error, msg string) {
|
||||
}
|
||||
json, err := json.Marshal(errorMessage)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
console.Fatalln(probe.NewError(err))
|
||||
}
|
||||
console.Println(string(json))
|
||||
return
|
||||
|
||||
+4
-3
@@ -86,7 +86,8 @@ func mainList(ctx *cli.Context) {
|
||||
fatalIf(err.Trace(arg), "Unable to parse argument ‘"+arg+"’.")
|
||||
|
||||
// if recursive strip off the "..."
|
||||
fatalIf(doListCmd(stripRecursiveURL(targetURL), isURLRecursive(targetURL)).Trace(), "Unable to list target ‘"+targetURL+"’.")
|
||||
err = doListCmd(stripRecursiveURL(targetURL), isURLRecursive(targetURL))
|
||||
fatalIf(err.Trace(targetURL), "Unable to list target ‘"+targetURL+"’.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +95,7 @@ func mainList(ctx *cli.Context) {
|
||||
func doListCmd(targetURL string, recursive bool) *probe.Error {
|
||||
clnt, err := target2Client(targetURL)
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
return err.Trace(targetURL)
|
||||
}
|
||||
return doList(clnt, recursive).Trace()
|
||||
return doList(clnt, recursive).Trace(targetURL)
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ VERSION:
|
||||
{{end}}
|
||||
`
|
||||
app.CommandNotFound = func(ctx *cli.Context, command string) {
|
||||
fatalIf(probe.NewError(errors.New("")), fmt.Sprintf("Command not found: ‘%s’", command))
|
||||
fatalIf(probe.NewError(errors.New("")), fmt.Sprintf("Command ‘%s’ not found.", command))
|
||||
}
|
||||
return app
|
||||
}
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ func doPrepareMirrorURLs(session *sessionV2, trapCh <-chan bool) {
|
||||
break
|
||||
}
|
||||
if sURLs.Error != nil {
|
||||
errorIf(sURLs.Error, "Unable to prepare mirror arguments.")
|
||||
errorIf(sURLs.Error.Trace(), "Unable to prepare mirror arguments.")
|
||||
break
|
||||
}
|
||||
if sURLs.isEmpty() {
|
||||
|
||||
+2
-2
@@ -86,8 +86,8 @@ func clearSession(sid string) {
|
||||
if sid == "all" {
|
||||
for _, sid := range getSessionIDs() {
|
||||
session, err := loadSessionV2(sid)
|
||||
fatalIf(err.Trace(sid), "Unable to load session ‘"+sid+"’")
|
||||
fatalIf(session.Delete().Trace(sid), "Unable to load session ‘"+sid+"’")
|
||||
fatalIf(err.Trace(sid), "Unable to load session ‘"+sid+"’.")
|
||||
fatalIf(session.Delete().Trace(sid), "Unable to load session ‘"+sid+"’.")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ func verifyMCRuntime() {
|
||||
console.Infoln("Configuration written to [" + mustGetMcConfigPath() + "]. Please update your access credentials.")
|
||||
}
|
||||
if !isSessionDirExists() {
|
||||
fatalIf(createSessionDir(), "Unable to create session dir.")
|
||||
fatalIf(createSessionDir().Trace(), "Unable to create session dir.")
|
||||
}
|
||||
checkGolangRuntimeVersion()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user