possibly useful, or not, logs for topology request
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
use crate::nym_api::error::NymAPIError;
|
||||
use crate::nym_api::routes::{CORE_STATUS_COUNT, SINCE_ARG};
|
||||
use async_trait::async_trait;
|
||||
use log::info;
|
||||
pub use nym_api_requests::{
|
||||
coconut::{
|
||||
models::{
|
||||
@@ -100,7 +101,9 @@ pub trait NymApiClientExt: ApiClient {
|
||||
&self,
|
||||
semver_compatibility: Option<String>,
|
||||
) -> Result<CachedNodesResponse<SkimmedNode>, NymAPIError> {
|
||||
info!("attempting to query the mixnodes/skimmed endpoint");
|
||||
let params = if let Some(semver_compatibility) = &semver_compatibility {
|
||||
info!("attaching semver_compatibility param");
|
||||
vec![("semver_compatibility", semver_compatibility.as_str())]
|
||||
} else {
|
||||
vec![]
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
use async_trait::async_trait;
|
||||
use reqwest::header::HeaderValue;
|
||||
use reqwest::{RequestBuilder, Response, StatusCode};
|
||||
use reqwest::{Error, RequestBuilder, Response, StatusCode};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Display;
|
||||
use std::time::Duration;
|
||||
use thiserror::Error;
|
||||
use tracing::warn;
|
||||
use tracing::{error, info, warn};
|
||||
use url::Url;
|
||||
|
||||
pub use reqwest::IntoUrl;
|
||||
@@ -207,6 +207,7 @@ impl Client {
|
||||
E: Display,
|
||||
{
|
||||
let url = sanitize_url(&self.base_url, path, params);
|
||||
info!("sanitised the request url into {url}");
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
@@ -222,7 +223,19 @@ impl Client {
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
Ok(self.reqwest_client.get(url).send().await?)
|
||||
let req = self.reqwest_client.get(url);
|
||||
match req.send().await {
|
||||
Ok(response) => {
|
||||
info!("request was succesfull");
|
||||
Ok(response)
|
||||
}
|
||||
Err(err) => {
|
||||
error!("request failed: {err}");
|
||||
error!("url: {:?}", err.url());
|
||||
error!("status code: {:?}", err.status());
|
||||
Err(err.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,6 +295,7 @@ impl Client {
|
||||
V: AsRef<str>,
|
||||
E: Display + DeserializeOwned,
|
||||
{
|
||||
info!("attempting to send the get request");
|
||||
let res = self.send_get_request(path, params).await?;
|
||||
parse_response(res, false).await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user