cli: Log errors return by Run functions

Turns

```
$ ./mgmt run
00:44:15 hello.go:46: This is: mgmt, version: 0.0.14-30-ge3a2648
00:44:15 hello.go:47: Main: Start: 1518738255855525279
$
```

Into

```
$ ./mgmt run
01:07:02 hello.go:46: This is: mgmt, version: 0.0.14-30-ge3a2648-dirty
01:07:02 hello.go:47: Main: Start: 1518739622517652739
01:07:02 cli.go:167: Main: Error: can't create prefix: mkdir /var/lib/mgmt/: permission denied
$
```
This commit is contained in:
Johan Bloemberg
2018-02-16 01:08:30 +01:00
committed by James Shubin
parent f12e502c61
commit 07714c67cb

View File

@@ -164,6 +164,8 @@ func run(c *cli.Context) error {
}()
if err := obj.Run(); err != nil {
// log the error message returned
log.Printf("Main: Error: %v", err)
//return cli.NewExitError(err.Error(), 1) // TODO: ?
return cli.NewExitError("", 1)
}