Skip to content

Commit

Permalink
Merge pull request #90 from RMeli/better-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RMeli authored Oct 13, 2023
2 parents b5532dd + 5336e35 commit 4c02adf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@

------------------------------------------------------------------------------

## Version X.Y.Z

Date: XX/YY/ZZZ
Contributors: @RMeli

### Improved

* Messages for `NotImplementedError` exceptions [PR #90 | @RMeli]


## Version 0.6.0

Date: 08/09/2023
Expand Down
16 changes: 12 additions & 4 deletions spyrmsd/optional/rdkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def load(fname: str):
else:
rdmol = _load_block_gzipped(Chem.MolFromPDBBlock, fname)
else:
raise NotImplementedError
raise NotImplementedError(
f"Format '{fmt}' is currently not supported with RDKit."
)

return rdmol

Expand All @@ -87,7 +89,11 @@ def loadall(fname: str):
fmt = utils.molformat(fname)

if fmt == "mol2":
raise NotImplementedError # See RDKit Issue #415
error = (
"Multiple molecules in MOL2 files are not supported. "
"See RDKit#415 (https://github.com/rdkit/rdkit/pull/415)."
)
raise NotImplementedError(error) # See RDKit Issue #415
elif fmt == "sdf":
if not gzipped:
rdmols = Chem.SDMolSupplier(fname, removeHs=False)
Expand All @@ -100,9 +106,11 @@ def loadall(fname: str):
mols = [rdmol for rdmol in rdmols]
elif fmt == "pdb":
# TODO: Implement
raise NotImplementedError
raise NotImplementedError("Multiple molecules in PDB files are not supported.")
else:
raise NotImplementedError
raise NotImplementedError(
f"Format '{fmt}' is currently not supported with RDKit."
)

return mols

Expand Down

0 comments on commit 4c02adf

Please sign in to comment.