Skip to content

Commit

Permalink
improve exception message when message type does not match (fix #21)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Nov 26, 2013
1 parent 646387c commit f42fa96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/genpy/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,8 @@ def serialize_fn_generator(msg_context, spec, is_numpy=False):
for y in serializer_generator(msg_context, flattened, True, is_numpy):
yield " "+y
pop_context()
yield "except struct.error as se: self._check_types(se)"
yield "except TypeError as te: self._check_types(te)"
yield "except struct.error as se: self._check_types(struct.error(\"%s: '%s' when writing '%s'\" % (type(se), str(se), str(_x))))"
yield "except TypeError as te: self._check_types(ValueError(\"%s: '%s' when writing '%s'\" % (type(te), str(te), str(_x))))"
# done w/ method-var context #

def deserialize_fn_generator(msg_context, spec, is_numpy=False):
Expand Down

0 comments on commit f42fa96

Please sign in to comment.