From 6e106dde1c39df31dd339e92b18b7d3eca44fbb6 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 26 Feb 2024 09:37:15 +0000 Subject: [PATCH] Improve error mesage when attempting to extract all dummy selection. [closes #250] [ci skip] --- .../Sandpit/Exscientia/_SireWrappers/_molecule.py | 6 +++++- python/BioSimSpace/_SireWrappers/_molecule.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_molecule.py b/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_molecule.py index 7da921f96..6de6095dd 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_molecule.py +++ b/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_molecule.py @@ -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(): diff --git a/python/BioSimSpace/_SireWrappers/_molecule.py b/python/BioSimSpace/_SireWrappers/_molecule.py index 44af7619c..089c88146 100644 --- a/python/BioSimSpace/_SireWrappers/_molecule.py +++ b/python/BioSimSpace/_SireWrappers/_molecule.py @@ -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():