File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,10 @@ fn respond(values: &[Value], _ctx: &mut Context) -> Signal {
5656 ) ) ;
5757 } ;
5858
59- let Some ( Kind :: StringValue ( _status_code_str) ) = & status_code_val. kind else {
59+ let Some ( Kind :: NumberValue ( _status_code_str) ) = & status_code_val. kind else {
6060 return Signal :: Failure ( RuntimeError :: simple (
6161 "InvalidArgumentRuntimeError" ,
62- "Expected 'status_code' to be StringValue " . to_string ( ) ,
62+ "Expected 'status_code' to be NumberValue " . to_string ( ) ,
6363 ) ) ;
6464 } ;
6565
@@ -162,7 +162,7 @@ fn create_response(values: &[Value], _ctx: &mut Context) -> Signal {
162162 kind : Some ( Kind :: StructValue ( headers. clone ( ) ) ) ,
163163 } ,
164164 ) ;
165- fields. insert ( "body " . to_string ( ) , payload. clone ( ) ) ;
165+ fields. insert ( "payload " . to_string ( ) , payload. clone ( ) ) ;
166166
167167 Signal :: Success ( Value {
168168 kind : Some ( Kind :: StructValue ( Struct { fields } ) ) ,
Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ fn handle_message(flow: ExecutionFlow, store: &FunctionStore) -> Option<Value> {
3333 match executor. execute ( flow. starting_node_id ) {
3434 Signal :: Success ( v) => Some ( v. clone ( ) ) ,
3535 Signal :: Respond ( v) => Some ( v. clone ( ) ) ,
36+ Signal :: Failure ( error ) => {
37+ log:: error!( "{:?}" , error) ;
38+ None
39+ }
3640 _ => None ,
3741 }
3842}
@@ -92,9 +96,18 @@ async fn main() {
9296 }
9397 } ;
9498
95- let value = handle_message ( flow, & store) . unwrap_or_else ( || Value {
96- kind : Some ( Kind :: NullValue ( 0 ) ) ,
97- } ) ;
99+ let value = match handle_message ( flow, & store) {
100+ None => {
101+ log:: error!( "Failed to handle message" ) ;
102+ Value {
103+ kind : Some ( Kind :: NullValue ( 0 ) ) ,
104+ }
105+ }
106+ Some ( v) => {
107+ log:: info!( "Handled message successfully" ) ;
108+ v
109+ }
110+ } ;
98111
99112 // Send a response to the reply subject
100113 if let Some ( reply) = msg. reply {
You can’t perform that action at this time.
0 commit comments