diff options
Diffstat (limited to 'src/lib/client.rs')
| -rw-r--r-- | src/lib/client.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/client.rs b/src/lib/client.rs index a8b48f4..7093dd5 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs | |||
| @@ -176,7 +176,7 @@ impl Connect for Client { | |||
| 176 | self.client | 176 | self.client |
| 177 | .add_relay(relay_url) | 177 | .add_relay(relay_url) |
| 178 | .await | 178 | .await |
| 179 | .context("cannot add relay")?; | 179 | .context("failed to add relay")?; |
| 180 | 180 | ||
| 181 | let relay = self.client.relay(relay_url).await?; | 181 | let relay = self.client.relay(relay_url).await?; |
| 182 | 182 | ||
| @@ -263,7 +263,7 @@ impl Connect for Client { | |||
| 263 | self.client | 263 | self.client |
| 264 | .add_relay(relay.as_str()) | 264 | .add_relay(relay.as_str()) |
| 265 | .await | 265 | .await |
| 266 | .context("cannot add relay")?; | 266 | .context("failed to add relay")?; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | let relays_map = self.client.relays().await; | 269 | let relays_map = self.client.relays().await; |
| @@ -374,7 +374,7 @@ impl Connect for Client { | |||
| 374 | self.client | 374 | self.client |
| 375 | .add_relay(relay.as_str()) | 375 | .add_relay(relay.as_str()) |
| 376 | .await | 376 | .await |
| 377 | .context("cannot add relay")?; | 377 | .context("failed to add relay")?; |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | let dim = Style::new().color256(247); | 380 | let dim = Style::new().color256(247); |
| @@ -741,7 +741,7 @@ fn pb_after_style(succeed: bool) -> indicatif::ProgressStyle { | |||
| 741 | 741 | ||
| 742 | async fn get_local_cache_database(git_repo_path: &Path) -> Result<NostrLMDB> { | 742 | async fn get_local_cache_database(git_repo_path: &Path) -> Result<NostrLMDB> { |
| 743 | NostrLMDB::open(git_repo_path.join(".git/nostr-cache.lmdb")) | 743 | NostrLMDB::open(git_repo_path.join(".git/nostr-cache.lmdb")) |
| 744 | .context("cannot open or create nostr cache database at .git/nostr-cache.lmdb") | 744 | .context("failed to open or create nostr cache database at .git/nostr-cache.lmdb") |
| 745 | } | 745 | } |
| 746 | 746 | ||
| 747 | async fn get_global_cache_database(git_repo_path: Option<&Path>) -> Result<NostrLMDB> { | 747 | async fn get_global_cache_database(git_repo_path: Option<&Path>) -> Result<NostrLMDB> { |
| @@ -753,13 +753,13 @@ async fn get_global_cache_database(git_repo_path: Option<&Path>) -> Result<Nostr | |||
| 753 | } | 753 | } |
| 754 | } else { | 754 | } else { |
| 755 | create_dir_all(get_dirs()?.cache_dir()).context(format!( | 755 | create_dir_all(get_dirs()?.cache_dir()).context(format!( |
| 756 | "cannot create cache directory in: {:?}", | 756 | "failed to create cache directory in: {:?}", |
| 757 | get_dirs()?.cache_dir() | 757 | get_dirs()?.cache_dir() |
| 758 | ))?; | 758 | ))?; |
| 759 | get_dirs()?.cache_dir().join("nostr-cache.lmdb") | 759 | get_dirs()?.cache_dir().join("nostr-cache.lmdb") |
| 760 | }; | 760 | }; |
| 761 | 761 | ||
| 762 | NostrLMDB::open(path).context("cannot open ngit global nostr cache database") | 762 | NostrLMDB::open(path).context("failed to open ngit global nostr cache database") |
| 763 | } | 763 | } |
| 764 | 764 | ||
| 765 | pub async fn get_events_from_local_cache( | 765 | pub async fn get_events_from_local_cache( |
| @@ -771,7 +771,7 @@ pub async fn get_events_from_local_cache( | |||
| 771 | .query(filters.clone()) | 771 | .query(filters.clone()) |
| 772 | .await | 772 | .await |
| 773 | .context( | 773 | .context( |
| 774 | "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb", | 774 | "failed to execute query on opened git repo nostr cache database .git/nostr-cache.lmdb", |
| 775 | )? | 775 | )? |
| 776 | .to_vec()) | 776 | .to_vec()) |
| 777 | } | 777 | } |
| @@ -784,7 +784,7 @@ pub async fn get_event_from_global_cache( | |||
| 784 | .await? | 784 | .await? |
| 785 | .query(filters.clone()) | 785 | .query(filters.clone()) |
| 786 | .await | 786 | .await |
| 787 | .context("cannot execute query on opened ngit nostr cache database")? | 787 | .context("failed to execute query on opened ngit nostr cache database")? |
| 788 | .to_vec()) | 788 | .to_vec()) |
| 789 | } | 789 | } |
| 790 | 790 | ||
| @@ -793,7 +793,7 @@ pub async fn save_event_in_local_cache(git_repo_path: &Path, event: &nostr::Even | |||
| 793 | .await? | 793 | .await? |
| 794 | .save_event(event) | 794 | .save_event(event) |
| 795 | .await | 795 | .await |
| 796 | .context("cannot save event in local cache") | 796 | .context("failed to save event in local cache") |
| 797 | } | 797 | } |
| 798 | 798 | ||
| 799 | pub async fn save_event_in_global_cache( | 799 | pub async fn save_event_in_global_cache( |
| @@ -804,7 +804,7 @@ pub async fn save_event_in_global_cache( | |||
| 804 | .await? | 804 | .await? |
| 805 | .save_event(event) | 805 | .save_event(event) |
| 806 | .await | 806 | .await |
| 807 | .context("cannot save event in local cache") | 807 | .context("failed to save event in local cache") |
| 808 | } | 808 | } |
| 809 | 809 | ||
| 810 | pub async fn get_repo_ref_from_cache( | 810 | pub async fn get_repo_ref_from_cache( |
| @@ -1634,7 +1634,7 @@ pub async fn get_event_from_cache_by_id(git_repo: &Repo, event_id: &EventId) -> | |||
| 1634 | ) | 1634 | ) |
| 1635 | .await? | 1635 | .await? |
| 1636 | .first() | 1636 | .first() |
| 1637 | .context("cannot find event in cache")? | 1637 | .context("failed to find event in cache")? |
| 1638 | .clone()) | 1638 | .clone()) |
| 1639 | } | 1639 | } |
| 1640 | 1640 | ||