Skip to content

Commit

Permalink
Make IndexError more verbose.
Browse files Browse the repository at this point in the history
Made #97 easier to trouble-shoot.
  • Loading branch information
sobolevnrm committed Nov 22, 2020
1 parent 67039aa commit 272329d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion propka/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,13 @@ def setup_atoms(self):
the_oxygen = self.atom.get_bonded_elements('O')
the_nitrogen = self.atom.get_bonded_elements('N')
# add protons to the nitrogen
PROTONATOR.protonate_atom(the_nitrogen[0])
try:
PROTONATOR.protonate_atom(the_nitrogen[0])
except IndexError:
raise IndexError(
"Unable to find bonded elements for the nitrogen associated "
"with amide group %s" % self.atom
)
the_hydrogens = the_nitrogen[0].get_bonded_elements('H')
# set the center using the oxygen and nitrogen amide atoms
self.set_center(the_oxygen+the_nitrogen)
Expand Down

0 comments on commit 272329d

Please sign in to comment.