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 compact_str::CompactString;
|
||||
|
@ -81,7 +81,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GraphQLResponse<T> {
|
||||
data: T,
|
||||
errors: Option<GhGraphQLErrors>,
|
||||
|
@ -109,7 +109,7 @@ pub(super) fn issue_graphql_query<T>(
|
|||
auth_token: &str,
|
||||
) -> impl Future<Output = Result<T, GhApiError>> + Send + Sync + 'static
|
||||
where
|
||||
T: DeserializeOwned,
|
||||
T: DeserializeOwned + Debug,
|
||||
{
|
||||
let res = to_json_string(&GraphQLQuery { query })
|
||||
.map_err(remote::Error::from)
|
||||
|
@ -132,6 +132,8 @@ where
|
|||
|
||||
let mut response: GraphQLResponse<T> = response.json().await?;
|
||||
|
||||
debug!("response = {response:?}");
|
||||
|
||||
if let Some(error) = response.errors.take() {
|
||||
Err(error.into())
|
||||
} else {
|
||||
|
|
|
@ -83,30 +83,30 @@ pub(super) fn fetch_release_artifacts_restful_api(
|
|||
)
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GraphQLData {
|
||||
repository: Option<GraphQLRepo>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GraphQLRepo {
|
||||
release: Option<GraphQLRelease>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GraphQLRelease {
|
||||
#[serde(rename = "releaseAssets")]
|
||||
assets: GraphQLReleaseAssets,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GraphQLReleaseAssets {
|
||||
nodes: Vec<Artifact>,
|
||||
#[serde(rename = "pageInfo")]
|
||||
page_info: GraphQLPageInfo,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GraphQLPageInfo {
|
||||
#[serde(rename = "endCursor")]
|
||||
end_cursor: Option<CompactString>,
|
||||
|
|
|
@ -48,7 +48,7 @@ pub(super) fn fetch_repo_info_restful_api(
|
|||
issue_restful_api(client, &["repos", owner, repo])
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GraphQLData {
|
||||
repository: Option<RepoInfo>,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue