33import json
44import logging
55
6+ import swf .format
67import swf .models
78import swf .models .decision
89import swf .exceptions
@@ -306,8 +307,9 @@ def replay(self, history):
306307
307308 decision = swf .models .decision .WorkflowExecutionDecision ()
308309 decision .fail (
309- reason = reason ,
310- details = details )
310+ reason = swf .format .reason (reason ),
311+ details = swf .format .details (details ),
312+ )
311313 return [decision ], {}
312314
313315 except Exception , err :
@@ -319,12 +321,12 @@ def replay(self, history):
319321 self .on_failure (reason )
320322
321323 decision = swf .models .decision .WorkflowExecutionDecision ()
322- decision .fail (reason = reason )
324+ decision .fail (reason = swf . format . reason ( reason ) )
323325
324326 return [decision ], {}
325327
326328 decision = swf .models .decision .WorkflowExecutionDecision ()
327- decision .complete (result = json .dumps (result ))
329+ decision .complete (result = swf . format . result ( json .dumps (result ) ))
328330
329331 return [decision ], {}
330332
@@ -339,8 +341,10 @@ def fail(self, reason, details=None):
339341
340342 decision = swf .models .decision .WorkflowExecutionDecision ()
341343 decision .fail (
342- reason = 'Workflow execution failed: {}' .format (reason ),
343- details = details )
344+ reason = swf .format .reason (
345+ 'Workflow execution failed: {}' .format (reason )),
346+ details = swf .format .details (details ),
347+ )
344348
345349 self ._decisions .append (decision )
346350 raise exceptions .ExecutionBlocked ('workflow execution failed' )
0 commit comments