File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,23 @@ use crate::error::RuntimeError;
33
44#[ derive( Debug ) ]
55pub enum Signal {
6+ // Will be signaled if a function has been executed successfully
67 Success ( Value ) ,
8+ // Will be signaled if
9+ // - a function recieves wrong parameter
10+ // - a function throws an error
11+ // - taurus itself throwns an error
12+ // - will stop the execution of the flow completly
713 Failure ( RuntimeError ) ,
14+ // Will be signaled if the `return` function has been executed
15+ // - will break the current context and return the value to the upper node
816 Return ( Value ) ,
17+ // Will be signaled if the `respond` function has been executed
18+ // - will stop the execution of the flow completly
19+ // - will return the value to the adapter
20+ Respond ( Value ) ,
21+ // Will be signaled if the `stop` function has been executed
22+ // - will stop the execution of the flow completly
923 Stop
1024}
1125
@@ -17,6 +31,7 @@ impl PartialEq for Signal {
1731 | ( Signal :: Failure ( _) , Signal :: Failure ( _) )
1832 | ( Signal :: Return ( _) , Signal :: Return ( _) )
1933 | ( Signal :: Stop , Signal :: Stop )
34+ | ( Signal :: Respond ( _) , Signal :: Respond ( _) )
2035 )
2136 }
22- }
37+ }
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ impl<'a> Executor<'a> {
4747 }
4848 Signal :: Failure ( error) => return Signal :: Failure ( error) ,
4949 Signal :: Stop => return Signal :: Stop ,
50+ Signal :: Respond ( value) => return Signal :: Respond ( value)
5051 }
5152 }
5253
@@ -71,6 +72,7 @@ impl<'a> Executor<'a> {
7172 }
7273 Signal :: Failure ( runtime_error) => return Signal :: Failure ( runtime_error) ,
7374 Signal :: Return ( value) => return Signal :: Return ( value) ,
75+ Signal :: Respond ( value) => return Signal :: Respond ( value) ,
7476 Signal :: Stop => return Signal :: Stop ,
7577 }
7678 }
You can’t perform that action at this time.
0 commit comments