Skip to content

Commit

Permalink
Improve error mesage when attempting to extract all dummy selection.
Browse files Browse the repository at this point in the history
[closes #250] [ci skip]
  • Loading branch information
lohedges committed Feb 26, 2024
1 parent 0334e54 commit 6e106dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,11 @@ def _extractMolecule(self, property_map={}, is_lambda1=False):
try:
search_result = mol.search(query, property_map)
except:
search_result = []
msg = "All atoms in the selection are dummies. Unable to extract."
if _isVerbose():
raise _IncompatibleError(msg) from e
else:
raise _IncompatibleError(msg) from None

# If there are no dummies, then simply return this molecule.
if len(search_result) == mol.nAtoms():
Expand Down
6 changes: 5 additions & 1 deletion python/BioSimSpace/_SireWrappers/_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,11 @@ def _extractMolecule(self, property_map={}, is_lambda1=False):
try:
search_result = mol.search(query, property_map)
except:
search_result = []
msg = "All atoms in the selection are dummies. Unable to extract."
if _isVerbose():
raise _IncompatibleError(msg) from e
else:
raise _IncompatibleError(msg) from None

# If there are no dummies, then simply return this molecule.
if len(search_result) == mol.nAtoms():
Expand Down

0 comments on commit 6e106dd

Please sign in to comment.