Skip to content

Make better error when path does not exist#32

Draft
supersonic-copycat wants to merge 1 commit intosnoyberg:masterfrom
supersonic-copycat:err_msg
Draft

Make better error when path does not exist#32
supersonic-copycat wants to merge 1 commit intosnoyberg:masterfrom
supersonic-copycat:err_msg

Conversation

@supersonic-copycat
Copy link
Copy Markdown

This is "brother-pull request" for #31
First, there should be no invalid paths, but if they happen, we got misleading error message (see issue 26). doesDirExists returns False if either path does not exist or it's not a directory. If file doesn't exists code execution goes to getGitFilesForWorktree and leads to strange error message.

So, we can also check if path exists at all and it's directory, so we can show user better error message.

doesDirExists returns False if either path does not exist or it's not a
directory. If file dos not exists code execution goes to
`getGitFilesForWorktree` and leads to misleading error message like

\cygdrive\c\...\.git: openBinaryFile: does not exist (No such file or directory)

while `.git` exists and is indeed a directory!
@supersonic-copycat
Copy link
Copy Markdown
Author

As proof of concept I just print it on stderr and return empty list -- later it will cause another exception, but at least user will have some hint what to do.
Better alternative would be throwing GitHashException. Likely, another variant should be created for such case (although, it should be rare enough, if #26 is fixed (maybe, with #31)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant