let time_beginning_loop = time::Instant::now();
if let Err(err) = check_and_update_dns(&config.api_key, &config.fqdn, &config.domains, config.ttl) {
- println!("!! Error: {}", err);
+ println!("!! {}", err);
}
let elapsed = time::Instant::now() - time_beginning_loop;
_ => Err(Box::new(Error { message: String::from("Can't parse IPv4 from ipify") }))
}
} else {
- Err(Box::new(Error { message: format!("Request unsuccessful: {:#?}", resp) }))
+ Err(Box::new(Error { message: format!("Request unsuccessful to {}: {:#?}", url, resp) }))
},
Err(error) => {
- Err(Box::new(Error { message: format!("Error during request: {:?}", error) }))
+ Err(Box::new(Error { message: format!("Error during request to {}: {:?}", url, error) }))
}
}
}
let request_builder =
match method {
- Method::Put(body) => client.put(url).body(body),
- Method::Get => client.get(url)
+ Method::Put(body) => client.put(&url).body(body),
+ Method::Get => client.get(&url)
};
match request_builder.header("Authorization", format!("Apikey {}", api_key)).send() {
let content = resp.text().unwrap();
Ok(serde_json::from_str(&content).unwrap())
} else {
- Err(Box::new(Error { message: format!("Request unsuccessful: {:#?}", resp) }))
+ Err(Box::new(Error { message: format!("Request unsuccessful to {}: {:#?}", &url, resp) }))
},
Err(error) =>
- Err(Box::new(Error { message: format!("Error during request: {:?}", error) }))
+ Err(Box::new(Error { message: format!("Error during request to {}: {:?}", &url, error) }))
}
}