Browse Source

Merge pull request #211 from docker/wrap_context_error

Wrap error cause so that we can understand why the cli cannot determine current context
Guillaume Tardif 5 years ago
parent
commit
bc1b2b778a
2 changed files with 2 additions and 2 deletions
  1. 1 1
      cli/main.go
  2. 1 1
      config/config.go

+ 1 - 1
cli/main.go

@@ -150,7 +150,7 @@ func main() {
 
 	currentContext, err := determineCurrentContext(opts.Context, configDir)
 	if err != nil {
-		fatal(errors.New("unable to determine current context"))
+		fatal(errors.Wrap(err, "unable to determine current context"))
 	}
 
 	s, err := store.New(store.WithRoot(configDir))

+ 1 - 1
config/config.go

@@ -99,7 +99,7 @@ func loadFile(path string, dest interface{}) error {
 		return errors.Wrap(err, "unable to read config file")
 	}
 	err = json.Unmarshal(data, dest)
-	return errors.Wrap(err, "unable to unmarshal config")
+	return errors.Wrap(err, "unable to unmarshal config file "+path)
 }
 
 func configFilePath(dir string) string {