From 50d179cbd398521e55046b9400eace3f2e0de1b6 Mon Sep 17 00:00:00 2001 From: Neshura Date: Wed, 27 Dec 2023 20:55:28 +0100 Subject: [PATCH] Log Zone name in case of Cloudflare API Error --- src/cloudflare.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cloudflare.rs b/src/cloudflare.rs index 8056993..44c938c 100644 --- a/src/cloudflare.rs +++ b/src/cloudflare.rs @@ -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 { 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}"),