Skip to content

Commit

Permalink
Catch OSError in find_vcs_root
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Feb 7, 2022
1 parent 42f5952 commit a3bcbe1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion get_version/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ def get_version_from_dirname(parent: Path) -> str:

def get_version_from_vcs(parent: Path, *, vcs: VCS = "any") -> str:
parent = parent.resolve()
vcs_root = find_vcs_root(parent, vcs=vcs)
try:
vcs_root = find_vcs_root(parent, vcs=vcs)
except OSError:
raise NoVersionFound(Source.vcs, "could not execute VCS command.")
if vcs_root is None:
raise NoVersionFound(
Source.vcs, f"could not find VCS from directory “{parent}”."
Expand Down

0 comments on commit a3bcbe1

Please sign in to comment.