added some errors to querying general
This commit is contained in:
@@ -151,6 +151,7 @@ pub mod general {
|
|||||||
use reqwest::StatusCode;
|
use reqwest::StatusCode;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use std::io::ErrorKind;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct LtoStats {
|
pub struct LtoStats {
|
||||||
@@ -189,14 +190,18 @@ pub mod general {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatusCode::INTERNAL_SERVER_ERROR => {
|
StatusCode::INTERNAL_SERVER_ERROR => {
|
||||||
panic!("Internal Server Error");
|
error!("Internal server error");
|
||||||
|
Err(Box::new(std::io::Error::new(
|
||||||
|
ErrorKind::ConnectionAborted,
|
||||||
|
"Internal server error",
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let query_url = format!("{}{}", API_BASE_URL, API_GENERAL_EXT,);
|
error!("Unexpected status: {}", response.status());
|
||||||
panic!(
|
Err(Box::new(std::io::Error::new(
|
||||||
"Unexpected server response: {:?} for query url: {}",
|
ErrorKind::Unsupported,
|
||||||
response, query_url
|
"Unexpected server response"
|
||||||
);
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user