Skip to content

Commit

Permalink
Add more descriptive error if sp and id are not provided (#915)
Browse files Browse the repository at this point in the history
Co-authored-by: Bradley Dice <bdice@bradleydice.com>
  • Loading branch information
cbkerr and bdice committed Apr 25, 2023
1 parent 522944a commit d87a6fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions signac/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,11 @@ def open_job(self, statepoint=None, id=None):
than one match.
"""
if (statepoint is None) == (id is None):
if statepoint is None and id is None:
raise ValueError("Must provide statepoint or id.")
elif statepoint is not None and id is not None:
raise ValueError("Either statepoint or id must be provided, but not both.")
if id is None:
elif statepoint is not None:
# Second best case (Job will update self._sp_cache on init)
return Job(project=self, statepoint=statepoint)
try:
Expand Down

0 comments on commit d87a6fd

Please sign in to comment.