Implemented Soft exit during IP-Fetching
This commit is contained in:
parent
f2d3fc5fb2
commit
ac2db79f21
1 changed files with 9 additions and 3 deletions
12
src/main.rs
12
src/main.rs
|
@ -1,6 +1,6 @@
|
|||
use serde_derive::{Deserialize, Serialize};
|
||||
use reqwest::blocking::get;
|
||||
use std::fs;
|
||||
use std::{fs, process::exit};
|
||||
mod cloudflare;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
@ -68,7 +68,10 @@ impl Ips {
|
|||
|
||||
match response {
|
||||
Ok(data) => self.ipv4 = data.text().expect("0.0.0.0").trim_end().to_owned(),
|
||||
Err(e) => panic!("{:#?}", e)
|
||||
Err(e) => {
|
||||
println!("Could not fetch IP4, quitting");
|
||||
exit(75);
|
||||
}
|
||||
}
|
||||
|
||||
let response = get(ipv6uri);
|
||||
|
@ -82,7 +85,10 @@ impl Ips {
|
|||
};
|
||||
self.ipv6base = stripped;
|
||||
},
|
||||
Err(e) => panic!("{:#?}", e)
|
||||
Err(e) => {
|
||||
println!("Could not fetch IP6, quitting");
|
||||
exit(75);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue