File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
crates/extensions/tedge_flows/src Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -118,12 +118,18 @@ impl TryFrom<BTreeMap<String, JsonValue>> for Message {
118118
119119 fn try_from ( value : BTreeMap < String , JsonValue > ) -> Result < Self , Self :: Error > {
120120 let Some ( JsonValue :: String ( topic) ) = value. get ( "topic" ) else {
121- return Err ( anyhow:: anyhow!( "Missing message topic" ) . into ( ) ) ;
121+ return Err ( anyhow:: anyhow!( "Message is missing the ' topic' property " ) . into ( ) ) ;
122122 } ;
123123 let payload = match value. get ( "payload" ) {
124124 Some ( JsonValue :: String ( payload) ) => payload. to_owned ( ) . into_bytes ( ) ,
125125 Some ( JsonValue :: Bytes ( payload) ) => payload. to_owned ( ) ,
126- _ => return Err ( anyhow:: anyhow!( "Missing message payload" ) . into ( ) ) ,
126+ None => return Err ( anyhow:: anyhow!( "Message is missing the 'payload' property" ) . into ( ) ) ,
127+ _ => {
128+ return Err ( anyhow:: anyhow!(
129+ "Unexpected payload format. Expected either a string or an ArrayBuffer"
130+ )
131+ . into ( ) )
132+ }
127133 } ;
128134 let timestamp = value
129135 . get ( "timestamp" )
You can’t perform that action at this time.
0 commit comments