Log Zone name in case of Cloudflare API Error
This commit is contained in:
parent
87a285bc2e
commit
0ab2c8c1a3
1 changed files with 3 additions and 1 deletions
|
@ -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}"),
|
||||
|
|
Loading…
Reference in a new issue