File tree 3 files changed +9
-8
lines changed
3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use bevy_http_client::prelude::*;
4
4
fn main ( ) {
5
5
App :: new ( )
6
6
. add_plugins ( ( MinimalPlugins , HttpClientPlugin ) )
7
- . add_systems ( Update , handle_response)
7
+ . add_systems ( Update , ( handle_response, handle_error ) )
8
8
. add_systems (
9
9
Update ,
10
10
send_request. run_if ( on_timer ( std:: time:: Duration :: from_secs ( 1 ) ) ) ,
@@ -22,3 +22,9 @@ fn handle_response(mut ev_resp: EventReader<HttpResponse>) {
22
22
println ! ( "response: {:?}" , response. text( ) ) ;
23
23
}
24
24
}
25
+
26
+ fn handle_error ( mut ev_error : EventReader < HttpResponseError > ) {
27
+ for error in ev_error. read ( ) {
28
+ println ! ( "Error retrieving IP: {}" , error. err) ;
29
+ }
30
+ }
Original file line number Diff line number Diff line change @@ -516,7 +516,7 @@ fn handle_request(
516
516
world. entity_mut ( entity) . despawn_recursive ( ) ;
517
517
}
518
518
} ) ;
519
- println ! ( "commands_queue: {:?}" , command_queue ) ;
519
+
520
520
tx. send ( command_queue) . unwrap ( ) ;
521
521
} )
522
522
. detach ( ) ;
Original file line number Diff line number Diff line change @@ -110,12 +110,7 @@ where
110
110
inner : T ,
111
111
}
112
112
113
- impl < T > TypedResponse < T > {
114
- /// Returns a reference to the inner data contained in the HTTP response.
115
- pub fn get_inner ( & self ) -> & T {
116
- & self . inner
117
- }
118
-
113
+ impl < T : for < ' a > serde:: Deserialize < ' a > > TypedResponse < T > {
119
114
/// Consumes the HTTP response and returns the inner data.
120
115
pub fn into_inner ( self ) -> T {
121
116
self . inner
You can’t perform that action at this time.
0 commit comments