Enhance URL parsing error handling in main function by logging errors when URL parsing fails.
This commit is contained in:
@@ -108,7 +108,13 @@ async fn main() -> anyhow::Result<()> {
|
||||
let url_file = tokio::fs::read_to_string(url_file).await?;
|
||||
let urls: Box<[url::Url]> = url_file
|
||||
.lines()
|
||||
.filter_map(|line| url::Url::parse(line).ok())
|
||||
.filter_map(|line| match url::Url::parse(line) {
|
||||
Ok(url) => Some(url),
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to parse URL: {line}: {e}");
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
tracing::info!("{} URLs found in {url_file}", urls.len());
|
||||
let exploiter = Exploiter::new(COMMANDS.clone());
|
||||
|
||||
Reference in New Issue
Block a user