From 0e56e63c833229ca02f2c62d4ee50cf371b6ac9a Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Tue, 9 May 2017 20:13:59 +0200 Subject: replace panic() by a collector for early errors --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index ef0bf62..5858518 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ import ( "path/filepath" "github.com/majewsky/gofu/pkg/cli" + "github.com/majewsky/gofu/pkg/earlyerrors" "github.com/majewsky/gofu/pkg/rtree" ) @@ -33,6 +34,14 @@ func main() { fmt.Fprintln(os.Stderr, "FATAL: initialization failed") os.Exit(255) } + + if len(earlyerrors.Get()) > 0 { + for _, msg := range earlyerrors.Get() { + ci.ShowError(msg) + } + os.Exit(255) + } + os.Exit(execApplet(ci, filepath.Base(os.Args[0]), os.Args[1:], true)) } -- cgit v1.3.1