removed unwrap and code cleanup

This commit is contained in:
aglkm
2024-09-13 16:02:36 +03:00
parent 1ec7734e6d
commit 45c6678c70
3 changed files with 6 additions and 8 deletions

View File

@@ -187,7 +187,7 @@ pub async fn get_market(dashboard: Arc<Mutex<Dashboard>>) -> Result<(), anyhow::
if CONFIG.coingecko_api == "enabled" && val != Value::Null {
// Check if CoingGecko API returned error
if let Some(status) = val.get("status") {
warn!("{}", status["error_message"].as_str().unwrap().to_string());
warn!("{}", status["error_message"].to_string());
} else {
data.price_usd = format!("{:.3}", val["grin"]["usd"].to_string().parse::<f64>().unwrap());
data.price_btc = format!("{:.8}", val["grin"]["btc"].to_string().parse::<f64>().unwrap());