From 38ece9b5a680b4fba53f6dd1dfc88f9fd5940c63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Tue, 20 Aug 2019 11:18:23 +0200 Subject: [PATCH] do not panic if reqwest does not work --- src/routes/blogs.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 12da8e4e..d8adee6f 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -110,6 +110,7 @@ pub fn domain_validation( let value = validation_getter.get(&validation_id); if value.is_none() { + // don't know how to cast Status::NotFound to u16 return Status::new(404, "validation id not found"); } @@ -120,6 +121,7 @@ pub fn domain_validation( // nope, expired (410: gone) if now.duration_since(*valid_until).as_secs() > 0 { validation_map.remove(&validation_id); + // don't know how to cast Status::Gone to u16 return Status::new(410, "validation expired"); } @@ -192,9 +194,11 @@ fn valid_domain(domain: &str, valid_domains: State resp.status().is_success(), + Err(_) => false, + } } #[post("/blogs/new", data = "
")]