Can't figure out what does error means while using reqwest

Hi, everyone!
To be short, I've written an api, to get a data from site and the return it in JSON from for my iOS app. It parses required pages every minute to sent to me the freshest results.
I've compiled it for a linux and launched it at the server.
The most funniest thing is that it works the full day, it gets data every minute but the night of the following day updating thread crashes. The code can still answer to requests as it is async but the thread for updating base is dead. I decided to figure out what's happening and found an error in logs. Its description would be lower. Note, that some time before it worked perfectly for maybe 2 or 3 weeks while I tested it. I've changed some lines of code after it but I didn't touch the part where error is located.

println!("Started collecting the Vec of all groups.");
let mut link_vec : Vec<String> = Vec::new();
let request = reqwest::get("").await.unwrap().text().await.unwrap(); // It crashes here.

The error description is :

thread 'tokio-runtime-worker' panicked at 'called Result::unwrap() on an Err value: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("")), port: None, path: "/search/celebrities?page=1", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Custom { kind: Uncategorized, error: "failed to lookup address information: Try again" })) }', src/
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

My provider also says that it's infrastructure is attacked and some problems may happen.

And my question is about the code. Is there a problem that I'm able to fix or should I just change my server provider? What does this error means?

    "dns error", 
    Custom { 
        kind: Uncategorized, 
        error: "failed to lookup address information: Try again" 

It's saying DNS failed. This probably means you lost your internet connection momentarily.

It's probably not necessary to panic (unwrap) when that happens, so instead you could try the request again after a short delay, or skip this one and just wait for the next minute.

thx a lot, I'll rewrite this piece of code and as you said, I'll have to change my server provider. Because there were no errors untill theese attacks started.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.