Skip to content

Commit

Permalink
throw RuntimeError if no system is found by expand_sys_str (#1292)
Browse files Browse the repository at this point in the history
Fix #1286.
  • Loading branch information
njzjz committed Jul 26, 2023
1 parent 2a6fd09 commit 801f279
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dpgen/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def expand_sys_str(root_dir: Union[str, Path]) -> list[str]:
-------
List[str]
list of string pointing to system directories
Raises
------
RuntimeError
No system was found in the directory
"""
root_dir = Path(root_dir)
if root_dir.is_dir():
Expand All @@ -66,6 +71,8 @@ def expand_sys_str(root_dir: Union[str, Path]) -> list[str]:
]
else:
raise OSError(f"{root_dir} does not exist.")
if len(matches) == 0:
raise RuntimeError("%s does not contain any systems!" % root_dir)
return matches


Expand Down

0 comments on commit 801f279

Please sign in to comment.