@@ -26,44 +26,38 @@ def reset(self, my_task):
2626 my_task .internal_data .pop (self .name , None )
2727 super ().reset (my_task )
2828
29- class ErrorEventDefinition (ItemAwareEventDefinition ):
30- """
31- Error events can occur only in subprocesses and as subprocess boundary events. They're
32- matched by code rather than name.
33- """
29+
30+ class CodeEventDefinition (ItemAwareEventDefinition ):
3431
3532 def __init__ (self , name , code = None , ** kwargs ):
36- super (ErrorEventDefinition , self ).__init__ (name , ** kwargs )
33+ super ().__init__ (name , ** kwargs )
3734 self .code = code
3835
36+ def throw (self , my_task ):
37+ payload = deepcopy (my_task .data )
38+ event = BpmnEvent (self , payload = payload , target = my_task .workflow )
39+ my_task .workflow .top_workflow .catch (event )
40+
3941 def details (self , my_task ):
4042 return PendingBpmnEvent (self .name , self .__class__ .__name__ , self .code )
4143
4244 def __eq__ (self , other ):
4345 return super ().__eq__ (other ) and self .code in [None , other .code ]
4446
4547
46- class EscalationEventDefinition (ItemAwareEventDefinition ):
48+ class ErrorEventDefinition (CodeEventDefinition ):
49+ """
50+ Error events can occur only in subprocesses and as subprocess boundary events. They're
51+ matched by code rather than name.
52+ """
53+ pass
54+
55+ class EscalationEventDefinition (CodeEventDefinition ):
4756 """
4857 Escalation events have names, though they don't seem to be used for anything. Instead
4958 the spec says that the escalation code should be matched.
5059 """
51-
52- def __init__ (self , name , code = None , ** kwargs ):
53- """
54- Constructor.
55-
56- :param escalation_code: The escalation code this event should
57- react to. If None then all escalations will activate this event.
58- """
59- super (EscalationEventDefinition , self ).__init__ (name , ** kwargs )
60- self .code = code
61-
62- def details (self , my_task ):
63- return PendingBpmnEvent (self .name , self .__class__ .__name__ , self .code )
64-
65- def __eq__ (self , other ):
66- return super ().__eq__ (other ) and self .code in [None , other .code ]
60+ pass
6761
6862
6963class SignalEventDefinition (ItemAwareEventDefinition ):
0 commit comments