From 815745b4c50232ac851a52c4f130cc64f81d2076 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Thu, 20 Oct 2022 23:54:00 +0200 Subject: Crawler: Add Err string in the craw_url method --- crawler/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crawler') diff --git a/crawler/src/main.rs b/crawler/src/main.rs index 999c0c0..2ffb1c7 100644 --- a/crawler/src/main.rs +++ b/crawler/src/main.rs @@ -45,18 +45,18 @@ fn crawler(root_urls: Vec<&str>) { } } -fn crawl_url(url: &str) -> Result<(String, Vec), ()> { +fn crawl_url(url: &str) -> Result<(String, Vec), String> { let url = "https://".to_owned() + url; println!("Crawling {:?}", url); let response_res = reqwest::blocking::get(&url); if response_res.is_err() { - return Err(()); + return Err("Error fetching ".to_owned() + &url); } let response_text_res = response_res.unwrap().text(); if response_text_res.is_err() { - return Err(()); + return Err("Error unwrapping the fetched HTML's text (".to_owned() + &url + ")"); } let response_text = response_text_res.unwrap(); -- cgit 1.4.1