Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a friendly error message when starting lazygit from a non-existent cwd #3192

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/app/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func knownError(tr *i18n.TranslationSet, err error) (string, bool) {
originalError: "fatal: not a git repository",
newError: tr.NotARepository,
},
{
originalError: "getwd: no such file or directory",
newError: tr.WorkingDirectoryDoesNotExist,
},
}

if mapping, ok := lo.Find(mappings, func(mapping errorMapping) bool {
Expand Down
2 changes: 2 additions & 0 deletions pkg/i18n/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ type TranslationSet struct {
StashIncludeUntrackedChanges string
StashOptions string
NotARepository string
WorkingDirectoryDoesNotExist string
Jump string
ScrollLeftRight string
ScrollLeft string
Expand Down Expand Up @@ -1153,6 +1154,7 @@ func EnglishTranslationSet() TranslationSet {
StashIncludeUntrackedChanges: "Stash all changes including untracked files",
StashOptions: "Stash options",
NotARepository: "Error: must be run inside a git repository",
WorkingDirectoryDoesNotExist: "Error: the current working directory does not exist",
Jump: "Jump to panel",
ScrollLeftRight: "Scroll left/right",
ScrollLeft: "Scroll left",
Expand Down
Loading