Explorar o código

client: log bad URIs

Justin Tracey %!s(int64=2) %!d(string=hai) anos
pai
achega
6d6765b4ec
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  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;