Browse Source

client: log bad URIs

Justin Tracey 2 years ago
parent
commit
6d6765b4ec
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/bin/mgen-client.rs

+ 8 - 1
src/bin/mgen-client.rs

@@ -144,7 +144,14 @@ async fn reader(
                     let url: hyper::Uri =
                         format!("{}/?size={}&user={}", target, msg.body.total_size(), user)
                             .parse()
-                            .expect("Invalid URI");
+                            .unwrap_or_else(|_| {
+                                panic!(
+                                    "Invalid URI: {}/?size={}&user={}",
+                                    target,
+                                    msg.body.total_size(),
+                                    user
+                                )
+                            });
                     let client = client.clone();
                     tokio::spawn(async move {
                         let mut res = client.get(url.clone()).await;