From a0593e3aa9b19b9ca3c3881cbe0d9d207fe46d2c Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 26 Nov 2024 07:48:30 +0000 Subject: refactor: err msgs 'cannot' > 'failed to' in nearly all cases 'cannot' was used when an action was tried and failed. 'failed to' is strictly better because: * just because the action didn't work that time doesnt mean it cannot work * it is better at drawing the users attention to a problem --- src/bin/git_remote_nostr/push.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/bin/git_remote_nostr/push.rs') diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 7161c5d..381a45e 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs @@ -92,7 +92,7 @@ pub async fn run_push( list_outputs.get(url).unwrap().to_owned() } else { bail!( - "cannot connect to git servers: {}", + "failed to connect to git servers: {}", repo_ref.git_server.join(" ") ); } @@ -245,7 +245,7 @@ pub async fn run_push( &[], ) .await - .context("cannot make patch event from commit")?; + .context("failed to make patch event from commit")?; events.push(new_patch.clone()); parent_patch = new_patch; } @@ -259,7 +259,7 @@ pub async fn run_push( ) .unwrap(); println!( - "error {to} cannot fastforward as newer patches found on proposal" + "error {to} failed to fastforward as newer patches found on proposal" ); rejected_proposal_refspecs.push(refspec.to_string()); } @@ -1089,7 +1089,7 @@ fn update_remote_refs_pushed( } } else { let commit = reference_to_commit(git_repo, from) - .context(format!("cannot get commit of reference {from}"))?; + .context(format!("failed to get commit of reference {from}"))?; if let Ok(mut remote_ref) = git_repo.find_reference(&target_ref_name) { remote_ref.set_target(commit, "updated by nostr remote helper")?; } else { @@ -1142,9 +1142,9 @@ fn refspec_remote_ref_name( fn reference_to_commit(git_repo: &Repository, reference: &str) -> Result { Ok(git_repo .find_reference(reference) - .context(format!("cannot find reference: {reference}"))? + .context(format!("failed to find reference: {reference}"))? .peel_to_commit() - .context(format!("cannot get commit from reference: {reference}"))? + .context(format!("failed to get commit from reference: {reference}"))? .id()) } @@ -1152,13 +1152,13 @@ fn reference_to_commit(git_repo: &Repository, reference: &str) -> Result { fn reference_to_ref_value(git_repo: &Repository, reference: &str) -> Result { let reference_obj = git_repo .find_reference(reference) - .context(format!("cannot find reference: {reference}"))?; + .context(format!("failed to find reference: {reference}"))?; if let Some(symref) = reference_obj.symbolic_target() { Ok(symref.to_string()) } else { Ok(reference_obj .peel_to_commit() - .context(format!("cannot get commit from reference: {reference}"))? + .context(format!("failed to get commit from reference: {reference}"))? .id() .to_string()) } -- cgit v1.2.3