diff options
Diffstat (limited to 'src/lib/repo_ref.rs')
| -rw-r--r-- | src/lib/repo_ref.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib/repo_ref.rs b/src/lib/repo_ref.rs index 84de185..05234e2 100644 --- a/src/lib/repo_ref.rs +++ b/src/lib/repo_ref.rs | |||
| @@ -95,7 +95,7 @@ impl TryFrom<nostr::Event> for RepoRef { | |||
| 95 | for pk in maintainers { | 95 | for pk in maintainers { |
| 96 | r.maintainers.push( | 96 | r.maintainers.push( |
| 97 | nostr_sdk::prelude::PublicKey::from_str(&pk) | 97 | nostr_sdk::prelude::PublicKey::from_str(&pk) |
| 98 | .context(format!("cannot convert entry from maintainers tag {pk} into a valid nostr public key. it should be in hex format")) | 98 | .context(format!("failed to convert entry from maintainers tag {pk} into a valid nostr public key. it should be in hex format")) |
| 99 | .context("invalid repository event")?, | 99 | .context("invalid repository event")?, |
| 100 | ); | 100 | ); |
| 101 | } | 101 | } |
| @@ -421,8 +421,9 @@ pub fn extract_pks(pk_strings: Vec<String>) -> Result<Vec<PublicKey>> { | |||
| 421 | let mut pks: Vec<PublicKey> = vec![]; | 421 | let mut pks: Vec<PublicKey> = vec![]; |
| 422 | for s in pk_strings { | 422 | for s in pk_strings { |
| 423 | pks.push( | 423 | pks.push( |
| 424 | nostr_sdk::prelude::PublicKey::from_bech32(s.clone()) | 424 | nostr_sdk::prelude::PublicKey::from_bech32(s.clone()).context(format!( |
| 425 | .context(format!("cannot convert {s} into a valid nostr public key"))?, | 425 | "failed to convert {s} into a valid nostr public key" |
| 426 | ))?, | ||
| 426 | ); | 427 | ); |
| 427 | } | 428 | } |
| 428 | Ok(pks) | 429 | Ok(pks) |
| @@ -441,15 +442,15 @@ pub fn save_repo_config_to_yaml( | |||
| 441 | .write(true) | 442 | .write(true) |
| 442 | .truncate(true) | 443 | .truncate(true) |
| 443 | .open(path) | 444 | .open(path) |
| 444 | .context("cannot open maintainers.yaml file with write and truncate options")? | 445 | .context("failed to open maintainers.yaml file with write and truncate options")? |
| 445 | } else { | 446 | } else { |
| 446 | std::fs::File::create(path).context("cannot create maintainers.yaml file")? | 447 | std::fs::File::create(path).context("failed to create maintainers.yaml file")? |
| 447 | }; | 448 | }; |
| 448 | let mut maintainers_npubs = vec![]; | 449 | let mut maintainers_npubs = vec![]; |
| 449 | for m in maintainers { | 450 | for m in maintainers { |
| 450 | maintainers_npubs.push( | 451 | maintainers_npubs.push( |
| 451 | m.to_bech32() | 452 | m.to_bech32() |
| 452 | .context("cannot convert public key into npub")?, | 453 | .context("failed to convert public key into npub")?, |
| 453 | ); | 454 | ); |
| 454 | } | 455 | } |
| 455 | serde_yaml::to_writer( | 456 | serde_yaml::to_writer( |
| @@ -460,7 +461,7 @@ pub fn save_repo_config_to_yaml( | |||
| 460 | relays, | 461 | relays, |
| 461 | }, | 462 | }, |
| 462 | ) | 463 | ) |
| 463 | .context("cannot write maintainers to maintainers.yaml file serde_yaml") | 464 | .context("failed to write maintainers to maintainers.yaml file serde_yaml") |
| 464 | } | 465 | } |
| 465 | 466 | ||
| 466 | #[cfg(test)] | 467 | #[cfg(test)] |