bstempi / pyswf

Classes that build on Boto's SWF classes to make workflow construction easier.
9 stars 0 forks source link

JSON must be escaped when sending back certain responses. #4

Open bstempi opened 8 years ago

bstempi commented 8 years ago

Snippet from a traceback:

  File "/usr/local/lib/python2.7/dist-packages/pyswfaws/activityworker.py", line 142, in start
    should_exit = self.handle_exception(e, activity_task)
  File "/usr/local/lib/python2.7/dist-packages/pyswfaws/activityworker.py", line 95, in handle_exception
    details=exception.message[:3000])
  File "/usr/local/lib/python2.7/dist-packages/boto/swf/layer1.py", line 224, in respond_activity_task_failed
    'reason': reason,
  File "/usr/local/lib/python2.7/dist-packages/boto/swf/layer1.py", line 118, in json_request
    return self.make_request(action, json_input, object_hook)
  File "/usr/local/lib/python2.7/dist-packages/boto/swf/layer1.py", line 145, in make_request
    raise excp_cls(response.status, response.reason, body=json_body)
boto.exception.SWFResponseError: SWFResponseError: 400 Bad Request
{u'Message': u'Start of list found where not expected', u'__type': u'com.amazon.coral.service#SerializationException'}

I happen to know that exception.message contains square brackets, which SWF is interpreting as a list. The framework needs to escape these types of things.