mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-25 22:32:13 +02:00
fewer panics
This commit is contained in:
@@ -67,7 +67,7 @@ func newDevelopmentLogger() *logrus.Logger {
|
|||||||
}
|
}
|
||||||
file, err := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
file, err := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
||||||
if err != nil {
|
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)
|
logger.SetOutput(file)
|
||||||
return logger
|
return logger
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ func getNeedAndWantLineIdx(firstLineIdx int, lastLineIdx int, selectedLineIdx in
|
|||||||
case HUNK:
|
case HUNK:
|
||||||
return firstLineIdx, lastLineIdx
|
return firstLineIdx, lastLineIdx
|
||||||
default:
|
default:
|
||||||
|
// we should never land here
|
||||||
panic("unknown mode")
|
panic("unknown mode")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -210,7 +211,7 @@ func GetRootDirectory() string {
|
|||||||
path = filepath.Dir(path)
|
path = filepath.Dir(path)
|
||||||
|
|
||||||
if path == "/" {
|
if path == "/" {
|
||||||
panic("must run in lazygit folder or child folder")
|
log.Fatal("must run in lazygit folder or child folder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user