Add error handling
This commit is contained in:
parent
a147535dc7
commit
046195503c
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user