add result return
This commit is contained in:
parent
0973bca227
commit
8de3a762ab
@ -58,13 +58,13 @@ impl CloudflareClient {
|
|||||||
if new_ip == self.current_ip {
|
if new_ip == self.current_ip {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
self.update_dns_records(new_ip).await;
|
self.update_dns_records(new_ip).await?;
|
||||||
self.current_ip = new_ip;
|
self.current_ip = new_ip;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_dns_records(&self, new_ip: Ipv4Addr) {
|
async fn update_dns_records(&self, new_ip: Ipv4Addr) -> Result<()> {
|
||||||
for domain in &self.domains {
|
for domain in &self.domains {
|
||||||
let records = match self.get_dns_records(domain).await {
|
let records = match self.get_dns_records(domain).await {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
@ -91,9 +91,12 @@ impl CloudflareClient {
|
|||||||
"On {}, failed to update {}: '{}' -> '{}': {:?}",
|
"On {}, failed to update {}: '{}' -> '{}': {:?}",
|
||||||
&domain, record.name, record.content, &new_ip_s, &e
|
&domain, record.name, record.content, &new_ip_s, &e
|
||||||
);
|
);
|
||||||
|
return Err(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_dns_records(&self, domain: &str) -> Result<Vec<DnsRecord>> {
|
async fn get_dns_records(&self, domain: &str) -> Result<Vec<DnsRecord>> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user