Skip to content

Commit

Permalink
Merge branch 'hss-nickname-error' into 'main'
Browse files Browse the repository at this point in the history
Have `arti hss onion-name` error if it doesn't print the onion name

See merge request tpo/core/arti!2305
  • Loading branch information
gabi-250 committed Aug 2, 2024
2 parents d4fcf86 + 405ada0 commit 3a7bcbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions crates/arti/src/subcommands/hss.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! The `hss` subcommand.
use anyhow::anyhow;
use arti_client::TorClientConfig;
use clap::ArgMatches;

Expand All @@ -23,8 +24,7 @@ pub(crate) fn run(
.find(|(n, _)| **n == nickname)
.map(|(_, cfg)| cfg.svc_cfg.clone())
else {
println!("Service {nickname} is not configured");
return Ok(());
return Err(anyhow!("Service {nickname} is not configured"));
};

// TODO: PreferredRuntime was arbitrarily chosen and is entirely unused
Expand All @@ -43,7 +43,9 @@ pub(crate) fn run(
if let Some(onion) = onion_svc.onion_name() {
println!("{onion}");
} else {
println!("Service {nickname} does not exist, or does not have an K_hsid yet");
return Err(anyhow!(
"Service {nickname} does not exist, or does not have an K_hsid yet"
));
}
}

Expand Down
3 changes: 2 additions & 1 deletion crates/arti/tests/testcases/hss/hss.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $ arti -c hss.toml hss --nickname acutus-cepa onion-name
mnyizjj7m3hpcr7i5afph3zt7maa65johyu2ruis6z7cmnjmaj3h6tad.onion

$ arti -c hss.toml hss --nickname flamingo onion-name
Service flamingo is not configured
? 127
[..]/arti: error: Service flamingo is not configured

```

0 comments on commit 3a7bcbe

Please sign in to comment.