Better error handling for some of wwctl commands

Better error handling, also prints a stack trace for `wwctl` if
`--debug` flag is used.
This commit is contained in:
WestleyR
2021-09-10 11:45:57 -07:00
parent c07a047976
commit 705b321f80
3 changed files with 27 additions and 43 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"fmt"
"os"
"github.com/hpcng/warewulf/internal/app/wwctl"
@@ -11,6 +12,10 @@ func main() {
err := root.Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], err)
if wwctl.DebugFlag {
fmt.Printf("\nSTACK TRACE: %+v\n", err)
}
os.Exit(255)
}
}