mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-16 15:46:36 +00:00
Add more debug logging
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
23a1bedc41
commit
a236f53121
3 changed files with 11 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
use std::{future::Future, sync::OnceLock, time::Duration};
|
use std::{fmt::Debug, future::Future, sync::OnceLock, time::Duration};
|
||||||
|
|
||||||
use binstalk_downloader::remote::{self, Response, Url};
|
use binstalk_downloader::remote::{self, Response, Url};
|
||||||
use compact_str::CompactString;
|
use compact_str::CompactString;
|
||||||
|
@ -81,7 +81,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct GraphQLResponse<T> {
|
struct GraphQLResponse<T> {
|
||||||
data: T,
|
data: T,
|
||||||
errors: Option<GhGraphQLErrors>,
|
errors: Option<GhGraphQLErrors>,
|
||||||
|
@ -109,7 +109,7 @@ pub(super) fn issue_graphql_query<T>(
|
||||||
auth_token: &str,
|
auth_token: &str,
|
||||||
) -> impl Future<Output = Result<T, GhApiError>> + Send + Sync + 'static
|
) -> impl Future<Output = Result<T, GhApiError>> + Send + Sync + 'static
|
||||||
where
|
where
|
||||||
T: DeserializeOwned,
|
T: DeserializeOwned + Debug,
|
||||||
{
|
{
|
||||||
let res = to_json_string(&GraphQLQuery { query })
|
let res = to_json_string(&GraphQLQuery { query })
|
||||||
.map_err(remote::Error::from)
|
.map_err(remote::Error::from)
|
||||||
|
@ -132,6 +132,8 @@ where
|
||||||
|
|
||||||
let mut response: GraphQLResponse<T> = response.json().await?;
|
let mut response: GraphQLResponse<T> = response.json().await?;
|
||||||
|
|
||||||
|
debug!("response = {response:?}");
|
||||||
|
|
||||||
if let Some(error) = response.errors.take() {
|
if let Some(error) = response.errors.take() {
|
||||||
Err(error.into())
|
Err(error.into())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -83,30 +83,30 @@ pub(super) fn fetch_release_artifacts_restful_api(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct GraphQLData {
|
struct GraphQLData {
|
||||||
repository: Option<GraphQLRepo>,
|
repository: Option<GraphQLRepo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct GraphQLRepo {
|
struct GraphQLRepo {
|
||||||
release: Option<GraphQLRelease>,
|
release: Option<GraphQLRelease>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct GraphQLRelease {
|
struct GraphQLRelease {
|
||||||
#[serde(rename = "releaseAssets")]
|
#[serde(rename = "releaseAssets")]
|
||||||
assets: GraphQLReleaseAssets,
|
assets: GraphQLReleaseAssets,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct GraphQLReleaseAssets {
|
struct GraphQLReleaseAssets {
|
||||||
nodes: Vec<Artifact>,
|
nodes: Vec<Artifact>,
|
||||||
#[serde(rename = "pageInfo")]
|
#[serde(rename = "pageInfo")]
|
||||||
page_info: GraphQLPageInfo,
|
page_info: GraphQLPageInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct GraphQLPageInfo {
|
struct GraphQLPageInfo {
|
||||||
#[serde(rename = "endCursor")]
|
#[serde(rename = "endCursor")]
|
||||||
end_cursor: Option<CompactString>,
|
end_cursor: Option<CompactString>,
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub(super) fn fetch_repo_info_restful_api(
|
||||||
issue_restful_api(client, &["repos", owner, repo])
|
issue_restful_api(client, &["repos", owner, repo])
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct GraphQLData {
|
struct GraphQLData {
|
||||||
repository: Option<RepoInfo>,
|
repository: Option<RepoInfo>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue