From 04a1be9bcb558ab4bc085e1d801c77684db0d721 Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 4 Mar 2024 16:43:06 +0100 Subject: [PATCH] Improved Error Message Syntax --- src/cloudflare.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cloudflare.rs b/src/cloudflare.rs index 0a56378..7e5335a 100644 --- a/src/cloudflare.rs +++ b/src/cloudflare.rs @@ -64,7 +64,7 @@ impl CloudflareZone { let entries = match response.json::() { Ok(data) => data, Err(e) => { - let err_msg = format!("Unable to parse API response. Error: {e}"); + let err_msg = format!("Unable to parse API response: {e}"); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -75,7 +75,7 @@ impl CloudflareZone { Ok(entries.result) } else { - let err_msg = format!("Unable to fetch Cloudflare Zone Entries for {}. Error: {}",self.name ,response.status()); + let err_msg = format!("Unable to fetch Cloudflare Zone Entries for {}: {}",self.name ,response.status()); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -84,7 +84,7 @@ impl CloudflareZone { } } Err(e) => { - let err_msg = format!("Unable to access Cloudflare API. Error: {e}"); + let err_msg = format!("Unable to access Cloudflare API: {e}"); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -107,7 +107,7 @@ impl CloudflareZone { self.validate_response(response) }, Err(e) => { - let err_msg = format!("Unable to access Cloudflare API. Error: {e}"); + let err_msg = format!("Unable to access Cloudflare API: {e}"); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -133,7 +133,7 @@ impl CloudflareZone { self.validate_response(response) }, Err(e) => { - let err_msg = format!("Unable to access Cloudflare API. Error: {e}"); + let err_msg = format!("Unable to access Cloudflare API: {e}"); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -174,7 +174,7 @@ impl CloudflareZone { self.validate_response(response) }, Err(e) => { - let err_msg = format!("Unable to access Cloudflare API. Error: {e}"); + let err_msg = format!("Unable to access Cloudflare API: {e}"); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -200,7 +200,7 @@ impl CloudflareZone { self.validate_response(response) }, Err(e) => { - let err_msg = format!("Unable to access Cloudflare API. Error: {e}"); + let err_msg = format!("Unable to access Cloudflare API: {e}"); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -270,7 +270,7 @@ impl CloudflareZone { match Url::parse(input) { Ok(url) => Ok(url), Err(e) => { - let err_msg = format!("Unable to parse URL. Error: {}", e); + let err_msg = format!("Unable to parse URL: {}", e); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -293,7 +293,7 @@ impl CloudflareZone { let data = match response.json::() { Ok(data) => data, Err(e) => { - let err_msg = format!("Unable to parse API response. Error: {e}"); + let err_msg = format!("Unable to parse API response: {e}"); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -305,7 +305,7 @@ impl CloudflareZone { match data.success { true => Ok(()), false => { - let err_msg = format!("Unexpected error while updating DNS record. Info: {:?}", data); + let err_msg = format!("Unexpected error while updating DNS record: {:?}", data); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"), @@ -314,7 +314,7 @@ impl CloudflareZone { } } } else { - let err_msg = format!("Unable to post/put Cloudflare DNS entry. Error: {}", response.status()); + let err_msg = format!("Unable to post/put Cloudflare DNS entry: {}", response.status()); match connected_to_journal() { true => error!("[ERROR] {err_msg}"), false => eprintln!("[ERROR] {err_msg}"),