diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-26 07:48:30 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-26 12:26:47 +0000 |
| commit | a0593e3aa9b19b9ca3c3881cbe0d9d207fe46d2c (patch) | |
| tree | 3482e7c558eff09cc91604ad6ddcd02cf2c94699 /test_utils | |
| parent | 1332c625b75fce616e06b415c99a068bc45c8210 (diff) | |
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
Diffstat (limited to 'test_utils')
| -rw-r--r-- | test_utils/src/git.rs | 2 | ||||
| -rw-r--r-- | test_utils/src/lib.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/test_utils/src/git.rs b/test_utils/src/git.rs index 470cd83..2562799 100644 --- a/test_utils/src/git.rs +++ b/test_utils/src/git.rs | |||
| @@ -265,7 +265,7 @@ impl GitTestRepo { | |||
| 265 | let branch = self | 265 | let branch = self |
| 266 | .git_repo | 266 | .git_repo |
| 267 | .find_branch(branch_name, git2::BranchType::Local) | 267 | .find_branch(branch_name, git2::BranchType::Local) |
| 268 | .context(format!("cannot find branch {branch_name}"))?; | 268 | .context(format!("failed to find branch {branch_name}"))?; |
| 269 | Ok(branch.into_reference().peel_to_commit()?.id()) | 269 | Ok(branch.into_reference().peel_to_commit()?.id()) |
| 270 | } | 270 | } |
| 271 | 271 | ||
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index ec05cfd..6ca0a43 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs | |||
| @@ -1054,7 +1054,7 @@ where | |||
| 1054 | /** copied from client.rs */ | 1054 | /** copied from client.rs */ |
| 1055 | async fn get_local_cache_database(git_repo_path: &Path) -> Result<NostrLMDB> { | 1055 | async fn get_local_cache_database(git_repo_path: &Path) -> Result<NostrLMDB> { |
| 1056 | NostrLMDB::open(git_repo_path.join(".git/nostr-cache.lmdb")) | 1056 | NostrLMDB::open(git_repo_path.join(".git/nostr-cache.lmdb")) |
| 1057 | .context("cannot open or create nostr cache database at .git/nostr-cache.lmdb") | 1057 | .context("failed to open or create nostr cache database at .git/nostr-cache.lmdb") |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| 1060 | /** copied from client.rs */ | 1060 | /** copied from client.rs */ |
| @@ -1067,7 +1067,7 @@ pub async fn get_events_from_cache( | |||
| 1067 | .query(filters.clone()) | 1067 | .query(filters.clone()) |
| 1068 | .await | 1068 | .await |
| 1069 | .context( | 1069 | .context( |
| 1070 | "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb", | 1070 | "failed to execute query on opened git repo nostr cache database .git/nostr-cache.lmdb", |
| 1071 | )? | 1071 | )? |
| 1072 | .to_vec()) | 1072 | .to_vec()) |
| 1073 | } | 1073 | } |
| @@ -1107,7 +1107,7 @@ pub fn get_proposal_branch_name_from_events( | |||
| 1107 | )); | 1107 | )); |
| 1108 | } | 1108 | } |
| 1109 | } | 1109 | } |
| 1110 | bail!("cannot find proposal root with branch-name tag matching title") | 1110 | bail!("failed to find proposal root with branch-name tag matching title") |
| 1111 | } | 1111 | } |
| 1112 | 1112 | ||
| 1113 | pub static FEATURE_BRANCH_NAME_1: &str = "feature-example-t"; | 1113 | pub static FEATURE_BRANCH_NAME_1: &str = "feature-example-t"; |