Log Zone name in case of Cloudflare API Error

This commit is contained in:
Neshura 2023-12-27 20:55:28 +01:00
parent 87a285bc2e
commit 0ab2c8c1a3
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -27,6 +27,7 @@ struct CloudflareApiResult {
}
pub(crate) struct CloudflareZone {
name: String,
email: String,
key: String,
id: String,
@ -36,6 +37,7 @@ impl CloudflareZone {
pub(crate) fn new(zone: &ZoneConfig) -> Result<Self, VarError> {
let key = env::var("CF_API_TOKEN")?;
Ok(Self {
name: zone.name.clone(),
email: zone.email.clone(),
key,
id: zone.id.clone(),
@ -75,7 +77,7 @@ impl CloudflareZone {
Ok(entries.result)
} else {
let err_msg = format!("Unable to fetch Cloudflare Zone Entries. Error: {}", response.status());
let err_msg = format!("Unable to fetch Cloudflare Zone Entries for {}. Error: {}",self.name ,response.status());
match connected_to_journal() {
true => error!("[ERROR] {err_msg}"),
false => eprintln!("[ERROR] {err_msg}"),