File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -651,7 +651,7 @@ pub struct UpdateMessageApiRequest<'a> {
651
651
}
652
652
653
653
impl < ' a > UpdateMessageApiRequest < ' a > {
654
- pub async fn send ( & self , client : & reqwest:: Client ) -> anyhow:: Result < reqwest :: Response > {
654
+ pub async fn send ( & self , client : & reqwest:: Client ) -> anyhow:: Result < ( ) > {
655
655
let bot_api_token = env:: var ( "ZULIP_API_TOKEN" ) . expect ( "ZULIP_API_TOKEN" ) ;
656
656
657
657
#[ derive( serde:: Serialize ) ]
@@ -664,7 +664,7 @@ impl<'a> UpdateMessageApiRequest<'a> {
664
664
pub content : Option < & ' a str > ,
665
665
}
666
666
667
- Ok ( client
667
+ let resp = client
668
668
. patch ( & format ! (
669
669
"{}/api/v1/messages/{}" ,
670
670
* ZULIP_URL , self . message_id
@@ -676,7 +676,21 @@ impl<'a> UpdateMessageApiRequest<'a> {
676
676
content : self . content ,
677
677
} )
678
678
. send ( )
679
- . await ?)
679
+ . await
680
+ . context ( "failed to send Zulip API Update Message" ) ?;
681
+
682
+ let status = resp. status ( ) ;
683
+
684
+ if !status. is_success ( ) {
685
+ let body = resp
686
+ . text ( )
687
+ . await
688
+ . context ( "fail receiving Zulip API response (when updating the message)" ) ?;
689
+
690
+ anyhow:: bail!( body)
691
+ }
692
+
693
+ Ok ( ( ) )
680
694
}
681
695
}
682
696
You can’t perform that action at this time.
0 commit comments