From 654393fe55f240d2bc449c7044c7fdb9d1a9b308 Mon Sep 17 00:00:00 2001 From: Xavier Robin <xavier.robin@unibas.ch> Date: Fri, 21 Feb 2025 10:55:02 +0100 Subject: [PATCH] fix: better error messages --- modules/mol/alg/pymod/chain_mapping.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/mol/alg/pymod/chain_mapping.py b/modules/mol/alg/pymod/chain_mapping.py index c5c1671ff..e9bab9736 100644 --- a/modules/mol/alg/pymod/chain_mapping.py +++ b/modules/mol/alg/pymod/chain_mapping.py @@ -441,12 +441,13 @@ class ReprResult: elif r.GetChemType() == mol.ChemType.AMINOACIDS: exp_atoms = exp_pep_atoms else: - raise RuntimeError("Something terrible happened... RUN...") + raise RuntimeError(f"Residue {r.qualified_name} has unexpected" + f" chem type {r.GetChemType()}") for aname in exp_atoms: a = r.FindAtom(aname) if not a.IsValid(): - raise RuntimeError("Something terrible happened... " - "RUN...") + raise RuntimeError(f"Expected atom {aname} missing from " + f"{r.qualified_name}") bb_pos.append(a.GetPos()) return bb_pos @@ -459,7 +460,8 @@ class ReprResult: if not at.IsValid(): at = r.FindAtom("C3'") if not at.IsValid(): - raise RuntimeError("Something terrible happened... RUN...") + raise RuntimeError(f"Residue {r.qualified_name} missing " + f"expected CA/C3' atom") bb_pos.append(at.GetPos()) return bb_pos -- GitLab