Author: bugman Date: Wed May 9 09:14:08 2012 New Revision: 16126 URL: http://svn.gna.org/viewcvs/relax?rev=16126&view=rev Log: Improved the error message system for the spin ID matching multiple spins This is a partial response to bug #19717 (http://gna.org/bugs/?19717) reported by Martin Ballaschk (http://gna.org/users/mab). Modified: 1.3/generic_fns/mol_res_spin.py 1.3/relax_errors.py Modified: 1.3/generic_fns/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/mol_res_spin.py?rev=16126&r1=16125&r2=16126&view=diff ============================================================================== --- 1.3/generic_fns/mol_res_spin.py (original) +++ 1.3/generic_fns/mol_res_spin.py Wed May 9 09:14:08 2012 @@ -47,7 +47,7 @@ from data.mol_res_spin import MoleculeContainer, ResidueContainer, SpinContainer from generic_fns import pipes from generic_fns import relax_re -from relax_errors import RelaxError, RelaxNoSpinError, RelaxResSelectDisallowError, RelaxSpinSelectDisallowError +from relax_errors import RelaxError, RelaxNoSpinError, RelaxMultiMolIDError, RelaxMultiResIDError, RelaxMultiSpinIDError, RelaxResSelectDisallowError, RelaxSpinSelectDisallowError from relax_warnings import RelaxWarning from status import Status; status = Status() @@ -2205,7 +2205,7 @@ # No unique identifier. if mol_num > 1: - raise RelaxError("The identifier " + repr(selection) + " corresponds to more than a single molecule in the " + repr(pipe) + " data pipe.") + raise RelaxMultiMolIDError(selection) # Return the molecule container. return mol_container @@ -2258,7 +2258,7 @@ # No unique identifier. if res_num > 1: - raise RelaxError("The identifier " + repr(selection) + " corresponds to more than a single residue in the " + repr(pipe) + " data pipe.") + raise RelaxMultiResIDError(selection) # Return the residue container. return res_container @@ -2324,7 +2324,7 @@ # No unique identifier. if spin_num > 1: - raise RelaxError("The identifier " + repr(selection) + " corresponds to more than a single spin in the " + repr(pipe) + " data pipe.") + raise RelaxMultiSpinIDError(selection) # Return the spin container. if full_info: Modified: 1.3/relax_errors.py URL: http://svn.gna.org/viewcvs/relax/1.3/relax_errors.py?rev=16126&r1=16125&r2=16126&view=diff ============================================================================== --- 1.3/relax_errors.py (original) +++ 1.3/relax_errors.py Wed May 9 09:14:08 2012 @@ -578,6 +578,30 @@ def __init__(self, pipe1, pipe2): self.text = "The number of spins do not match between pipes '%s' and '%s'." % (pipe1, pipe2) +# Multiple spins matching the ID. +class RelaxMultiMolIDError(BaseError): + def __init__(self, id): + if id == '': + self.text = "The empty molecule ID corresponds to more than a single molecule in the current data pipe." + else: + self.text = "The molecule ID '%s' corresponds to more than a single molecule in the current data pipe." % id + +# Multiple spins matching the ID. +class RelaxMultiResIDError(BaseError): + def __init__(self, id): + if id == '': + self.text = "The empty residue ID corresponds to more than a single residue in the current data pipe." + else: + self.text = "The residue ID '%s' corresponds to more than a single residue in the current data pipe." % id + +# Multiple spins matching the ID. +class RelaxMultiSpinIDError(BaseError): + def __init__(self, id): + if id == '': + self.text = "The empty spin ID corresponds to more than a single spin in the current data pipe." + else: + self.text = "The spin ID '%s' corresponds to more than a single spin in the current data pipe." % id + # Cannot find the residue in the sequence. class RelaxNoResError(BaseError): def __init__(self, number, name=None):