From bbfbb2d8b0c58d9e97fa933d985745eb50d255fb Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 14 Aug 2024 15:40:15 +0300 Subject: [PATCH] fix(main): better feedback on url parse error --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index c586f5f..e7f3c1a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -549,8 +549,11 @@ async fn main() { if let Some((url, tasks)) = relays.iter().find(|(key, _)| key.as_str().starts_with(&input)) { selected_relay = Some(url.clone()); or_print(tasks.print_tasks()); - } else if let Some(url) = or_print(Url::parse(&input)) { - match tx.send(MostrMessage::NewRelay(url.clone())) { + continue; + } + 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}"), Ok(_) => { info!("Connecting to {url}");