diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-09 14:09:15 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-09 14:14:47 +1100 |
commit | 2436ff197a6493d57a689f14e167c64b41ee500a (patch) | |
tree | d92522a0a3d484f3ca78de131b6d4c9d402b4465 /pkg | |
parent | 3b30b9bba260dc06a21a010cbb5a05f363f65a29 (diff) |
fewer panics
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/app/app.go | 2 | ||||
-rw-r--r-- | pkg/gui/lbl/focus.go | 1 | ||||
-rw-r--r-- | pkg/integration/integration.go | 3 |
3 files changed, 4 insertions, 2 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go index c3df367ec..cb9aaafea 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -67,7 +67,7 @@ func newDevelopmentLogger() *logrus.Logger { } file, err := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) if err != nil { - panic("unable to log to file") // TODO: don't panic (also, remove this call to the `panic` function) + log.Fatalf("Unable to log to log file: %v", err) } logger.SetOutput(file) return logger diff --git a/pkg/gui/lbl/focus.go b/pkg/gui/lbl/focus.go index ea70fbb3d..780551e5d 100644 --- a/pkg/gui/lbl/focus.go +++ b/pkg/gui/lbl/focus.go @@ -47,6 +47,7 @@ func getNeedAndWantLineIdx(firstLineIdx int, lastLineIdx int, selectedLineIdx in case HUNK: return firstLineIdx, lastLineIdx default: + // we should never land here panic("unknown mode") } } diff --git a/pkg/integration/integration.go b/pkg/integration/integration.go index 3ae60f740..9c498e849 100644 --- a/pkg/integration/integration.go +++ b/pkg/integration/integration.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + "log" "os" "os/exec" "path/filepath" @@ -210,7 +211,7 @@ func GetRootDirectory() string { path = filepath.Dir(path) if path == "/" { - panic("must run in lazygit folder or child folder") + log.Fatal("must run in lazygit folder or child folder") } } } |