Improved Error Message Syntax

This commit is contained in:
Neshura 2024-03-04 16:43:06 +01:00
parent 49b8d8cc05
commit 04a1be9bcb
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -64,7 +64,7 @@ impl CloudflareZone {
let entries = match response.json::<CloudflareApiResults>() {
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::<CloudflareApiResult>() {
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}"),