Skip to content

Commit

Permalink
Merge pull request #32 from mokshaproject/feature/warn-multipart
Browse files Browse the repository at this point in the history
Raise a more meaningful exception if txZMQ calls us in an unexpected way.
  • Loading branch information
ralphbean committed Oct 13, 2016
2 parents 4624014 + f3da13e commit c24586a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion moksha.hub/moksha/hub/zeromq/zeromq.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,14 @@ def subscribe(self, topic, callback):
log.warn("Failed txzmq create on %r %r" % (endpoint, e))
continue

def chain_over_moksha_callbacks(_body, _topic):
def chain_over_moksha_callbacks(*parts):
if len(parts) != 2:
raise ValueError(
"Moksha can only handle multipart messages with a "
"topic followed by a body. Got %r" % parts)

_body, _topic = parts

if isinstance(_topic, six.binary_type):
_topic = _topic.decode('utf-8')
if isinstance(_body, six.binary_type):
Expand Down

0 comments on commit c24586a

Please sign in to comment.