Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix log. #236

Merged
merged 5 commits into from
Mar 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix.
ssuchichan committed Mar 11, 2024
commit 59f48b9007b41dec6c479906596855fe4f43de4b
9 changes: 4 additions & 5 deletions explorer/src/service/v1/price.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::service::api::Api;
use anyhow::Result;
use log::error;
use poem_openapi::param::{Path, Query};
use poem_openapi::types::Type;
use poem_openapi::{payload::Json, ApiResponse, Object};
@@ -114,7 +113,7 @@ pub async fn simple_price(
ids.0, vs_currencies.0
);
let resp1 = reqwest::get(url).await;
if let Err(e) = resp1 {
if resp1.is_err() {
let fra_price = get_fra_price(api).await?;
return Ok(SimplePriceResponse::Ok(Json(SimplePriceResult {
code: 200,
@@ -124,7 +123,7 @@ pub async fn simple_price(
}

let resp2 = resp1?.json::<SimplePrice>().await;
if let Err(e) = resp2 {
if resp2.is_err() {
let fra_price = get_fra_price(api).await?;
return Ok(SimplePriceResponse::Ok(Json(SimplePriceResult {
code: 200,
@@ -170,7 +169,7 @@ pub async fn market_chart(
url = format!("https://api.coingecko.com/api/v3/coins/{}/market_chart?vs_currency={}&days={}&interval={}", id.0, vs_currency.0, days.0, itv);
}
let resp1 = reqwest::get(url).await;
if let Err(e) = resp1 {
if resp1.is_err() {
let fmc = get_fra_market(api).await?;
return Ok(MarketChartResponse::Ok(Json(MarketChartResult {
code: 200,
@@ -179,7 +178,7 @@ pub async fn market_chart(
})));
}
let resp2 = resp1?.json::<FraMarketChart>().await;
if let Err(e) = resp2 {
if resp2.is_err() {
let fmc = get_fra_market(api).await?;
return Ok(MarketChartResponse::Ok(Json(MarketChartResult {
code: 200,