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

enhance err msg for source subgraph manifest resolution in composition #5874

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 25 additions & 8 deletions graph/src/data_source/subgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,32 @@ impl UnresolvedDataSource {
let source_raw = resolver
.cat(logger, &self.source.address.to_ipfs_link())
.await
.context("Failed to resolve source subgraph manifest")?;
.context(format!(
"Failed to resolve source subgraph [{}] manifest",
self.source.address,
))?;

let source_raw: serde_yaml::Mapping = serde_yaml::from_slice(&source_raw)
.context("Failed to parse source subgraph manifest as YAML")?;
let source_raw: serde_yaml::Mapping =
serde_yaml::from_slice(&source_raw).context(format!(
"Failed to parse source subgraph [{}] manifest as YAML",
self.source.address
))?;

let deployment_hash = self.source.address.clone();

let source_manifest = UnresolvedSubgraphManifest::<C>::parse(deployment_hash, source_raw)
.context("Failed to parse source subgraph manifest")?;
.context(format!(
"Failed to parse source subgraph [{}] manifest",
self.source.address
))?;

source_manifest
.resolve(resolver, logger, LATEST_VERSION.clone())
.await
.context("Failed to resolve source subgraph manifest")
.context(format!(
"Failed to resolve source subgraph [{}] manifest",
self.source.address
))
.map(Arc::new)
}

Expand All @@ -292,12 +304,16 @@ impl UnresolvedDataSource {
.iter()
.any(|ds| matches!(ds, crate::data_source::DataSource::Subgraph(_)))
{
return Err(anyhow!("Nested subgraph data sources are not supported."));
return Err(anyhow!(
"Nested subgraph data sources [{}] are not supported.",
self.name
));
}

if source_spec_version < &SPEC_VERSION_1_3_0 {
return Err(anyhow!(
"Source subgraph manifest spec version {} is not supported, minimum supported version is {}",
"Source subgraph [{}] manifest spec version {} is not supported, minimum supported version is {}",
self.source.address,
source_spec_version,
SPEC_VERSION_1_3_0
));
Expand All @@ -310,7 +326,8 @@ impl UnresolvedDataSource {

if pruning_enabled {
return Err(anyhow!(
"Pruning is enabled for source subgraph, which is not supported"
"Pruning is enabled for source subgraph [{}], which is not supported",
self.source.address
));
}

Expand Down
3 changes: 2 additions & 1 deletion store/test-store/tests/chain/ethereum/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,8 @@ specVersion: 1.3.0
assert!(matches!(e, SubgraphManifestResolveError::ResolveError(_)));
let error_msg = e.to_string();
println!("{}", error_msg);
assert!(error_msg.contains("Nested subgraph data sources are not supported."));
assert!(error_msg
.contains("Nested subgraph data sources [SubgraphSource] are not supported."));
}
}
})
Expand Down
Loading