Skip to content

Commit

Permalink
Report the problem species if an error occurs making a species from i…
Browse files Browse the repository at this point in the history
…nput file.
  • Loading branch information
rwest committed Oct 23, 2020
1 parent 8948f18 commit 3ab4eca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rmgpy/rmg/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ def species(label, structure, reactive=True):
if '+' in label:
raise InputError('species {0} label cannot include a + sign'.format(label))

spec, is_new = rmg.reaction_model.make_new_species(structure, label=label, reactive=reactive)
try:
spec, is_new = rmg.reaction_model.make_new_species(structure, label=label, reactive=reactive)
except:
logging.error(f'Error when reading species "{label}" from input file.')
raise
if not is_new:
raise InputError("Species {0} is a duplicate of {1}. Species in input file must be unique".format(label,
spec.label))
Expand Down

0 comments on commit 3ab4eca

Please sign in to comment.