summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-02-18 19:42:23 +1100
committerJesse Duffield <jessedduffield@gmail.com>2019-02-18 19:42:23 +1100
commitadc252901944e84433cb8a50de9b114ba120282d (patch)
tree914cc8c0276f402ff1b0dfbcb3b89dfbab242936 /main.go
parent43ab7318d37e049cf3ae406fed8823c5c7f577a3 (diff)
dealing better with errors at the top level
Diffstat (limited to 'main.go')
-rw-r--r--main.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/main.go b/main.go
index edf1e7207..8bbd55d40 100644
--- a/main.go
+++ b/main.go
@@ -8,6 +8,7 @@ import (
"path/filepath"
"runtime"
+ "github.com/go-errors/errors"
"github.com/jesseduffield/lazygit/pkg/app"
"github.com/jesseduffield/lazygit/pkg/config"
)
@@ -44,11 +45,17 @@ func main() {
log.Fatal(err.Error())
}
- app, err := app.Setup(appConfig)
- if err != nil {
- app.Log.Error(err.Error())
- log.Fatal(err.Error())
+ app, err := app.NewApp(appConfig)
+
+ if err == nil {
+ err = app.Run()
}
- app.Gui.RunWithSubprocesses()
+ if err != nil {
+ newErr := errors.Wrap(err, 0)
+ stackTrace := newErr.ErrorStack()
+ app.Log.Error(stackTrace)
+
+ log.Fatal(fmt.Sprintf("%s\n\n%s", app.Tr.SLocalize("ErrorOccurred"), stackTrace))
+ }
}