1- use anyhow:: { anyhow, Result } ;
1+ use anyhow:: { anyhow, Context , Result } ;
22use async_trait:: async_trait;
33use core:: fmt;
44use dyn_clone:: DynClone ;
@@ -207,9 +207,9 @@ impl Client {
207207 } ;
208208 for version in & self . config. versions {
209209 let ip_result = match & self . config. source {
210- IpSource :: Stun => self . fetch_ip_stun( version) . await ,
211- IpSource :: Http => self . fetch_ip_http( version) . await ,
212- IpSource :: Interface ( interface) => fetch_ip_interface( interface, version) ,
210+ IpSource :: Stun => self . fetch_ip_stun( version) . await . context ( "Failed to fetch IP via STUN" ) ,
211+ IpSource :: Http => self . fetch_ip_http( version) . await . context ( "Failed to fetch IP via HTTP" ) ,
212+ IpSource :: Interface ( interface) => fetch_ip_interface( interface, version) . context ( "Failed to fetch IP via interface" ) ,
213213 } ;
214214 match ip_result {
215215 Ok ( ip) => match version {
@@ -221,6 +221,10 @@ impl Client {
221221 }
222222 }
223223 }
224+ if update. v4. is_none( ) && update. v6. is_none( ) {
225+ error!( "Failed to fetch IP address, skipping update..." ) ;
226+ continue ;
227+ }
224228 debug!( "Found IP(s): {update}" ) ;
225229 if update == * self . cache. read( ) . await {
226230 debug!( "No IP address change detected, skipping update..." ) ;
@@ -246,7 +250,7 @@ impl Client {
246250 match result {
247251 Ok ( result) => {
248252 if let Err ( error) = result {
249- error!( "Failed to update provider: {error}" ) ;
253+ error!( "Error updating provider: {error}" ) ;
250254 failed = true ;
251255 }
252256 } ,
0 commit comments