Merge pull request #32 from kdeng00/warning_fix

Warning fix
This commit was merged in pull request #32.
This commit is contained in:
KD
2025-03-14 22:54:59 -04:00
committed by GitHub
2 changed files with 19 additions and 5 deletions
+8
View File
@@ -193,6 +193,14 @@ impl CommitManager {
} }
Err(er) => { Err(er) => {
println!("Error {:?}", er); println!("Error {:?}", er);
match er {
syncers::download::MyError::Request(r) => {
println!("Error {:?}", r)
}
syncers::download::MyError::Other(ot) => {
println!("Error {:?}", ot)
}
}
} }
} }
} }
+11 -5
View File
@@ -16,7 +16,7 @@ impl Default for Download {
#[derive(Debug)] #[derive(Debug)]
pub enum MyError { pub enum MyError {
_Request(reqwest::Error), Request(reqwest::Error),
Other(String), Other(String),
} }
@@ -41,12 +41,13 @@ impl Download {
.get(&url) .get(&url)
.header(reqwest::header::AUTHORIZATION, &access_token) .header(reqwest::header::AUTHORIZATION, &access_token)
.send() .send()
.await .await;
.unwrap();
match response.status() { match response {
Ok(rep) => {
match rep.status() {
reqwest::StatusCode::OK => { reqwest::StatusCode::OK => {
let data = response.text(); let data = rep.text();
match data.await { match data.await {
Ok(e) => { Ok(e) => {
return Ok(e); return Ok(e);
@@ -63,6 +64,11 @@ impl Download {
panic!("Uh oh! Something unexpected happened: {:?}", other); panic!("Uh oh! Something unexpected happened: {:?}", other);
} }
} }
}
Err(er) => {
return Err(MyError::Request(er));
}
}
return Err(MyError::Other(String::from("Error downloading"))); return Err(MyError::Other(String::from("Error downloading")));
} }