Add error handling

This commit is contained in:
Sik Yoon 2023-07-31 22:46:44 +09:00
parent a147535dc7
commit 046195503c

View File

@ -162,6 +162,11 @@ pub async fn market_cap_index() -> Result<(), Box<dyn std::error::Error + Send +
Ok(T) => {
text = T.text().await?;
v = serde_json::from_str(text.as_str()).unwrap();
if v.as_object().is_none() {
return Err("Err")?;
}
into_vec = v
.as_object()
.unwrap()