forked from janek/mostr
1
0
Fork 0

fix(main): better feedback on url parse error

This commit is contained in:
xeruf 2024-08-14 15:40:15 +03:00
parent f5aca3eca8
commit bbfbb2d8b0
1 changed files with 5 additions and 2 deletions

View File

@ -549,8 +549,11 @@ async fn main() {
if let Some((url, tasks)) = relays.iter().find(|(key, _)| key.as_str().starts_with(&input)) { if let Some((url, tasks)) = relays.iter().find(|(key, _)| key.as_str().starts_with(&input)) {
selected_relay = Some(url.clone()); selected_relay = Some(url.clone());
or_print(tasks.print_tasks()); or_print(tasks.print_tasks());
} else if let Some(url) = or_print(Url::parse(&input)) { continue;
match tx.send(MostrMessage::NewRelay(url.clone())) { }
match Url::parse(&input) {
Err(e) => warn!("Failed to parse url \"{input}\": {}", e),
Ok(url) => match tx.send(MostrMessage::NewRelay(url.clone())) {
Err(e) => error!("Nostr communication thread failure, cannot add relay \"{url}\": {e}"), Err(e) => error!("Nostr communication thread failure, cannot add relay \"{url}\": {e}"),
Ok(_) => { Ok(_) => {
info!("Connecting to {url}"); info!("Connecting to {url}");