Skip to content

Commit 38d7a33

Browse files
committed
graph: enhance err msg for source subgraph manifest resolution in composition
1 parent be6c940 commit 38d7a33

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

graph/src/data_source/subgraph.rs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,20 +262,32 @@ impl UnresolvedDataSource {
262262
let source_raw = resolver
263263
.cat(logger, &self.source.address.to_ipfs_link())
264264
.await
265-
.context("Failed to resolve source subgraph manifest")?;
265+
.context(format!(
266+
"Failed to resolve source subgraph [{}] manifest",
267+
self.source.address,
268+
))?;
266269

267-
let source_raw: serde_yaml::Mapping = serde_yaml::from_slice(&source_raw)
268-
.context("Failed to parse source subgraph manifest as YAML")?;
270+
let source_raw: serde_yaml::Mapping =
271+
serde_yaml::from_slice(&source_raw).context(format!(
272+
"Failed to parse source subgraph [{}] manifest as YAML",
273+
self.source.address
274+
))?;
269275

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

272278
let source_manifest = UnresolvedSubgraphManifest::<C>::parse(deployment_hash, source_raw)
273-
.context("Failed to parse source subgraph manifest")?;
279+
.context(format!(
280+
"Failed to parse source subgraph [{}] manifest",
281+
self.source.address
282+
))?;
274283

275284
source_manifest
276285
.resolve(resolver, logger, LATEST_VERSION.clone())
277286
.await
278-
.context("Failed to resolve source subgraph manifest")
287+
.context(format!(
288+
"Failed to resolve source subgraph [{}] manifest",
289+
self.source.address
290+
))
279291
.map(Arc::new)
280292
}
281293

@@ -346,7 +358,8 @@ impl UnresolvedDataSource {
346358
let source_spec_version = &source_manifest.spec_version;
347359
if source_spec_version < &SPEC_VERSION_1_3_0 {
348360
return Err(anyhow!(
349-
"Source subgraph manifest spec version {} is not supported, minimum supported version is {}",
361+
"Source subgraph [{}] manifest spec version {} is not supported, minimum supported version is {}",
362+
self.source.address,
350363
source_spec_version,
351364
SPEC_VERSION_1_3_0
352365
));
@@ -367,7 +380,10 @@ impl UnresolvedDataSource {
367380
.iter()
368381
.any(|ds| matches!(ds, crate::data_source::DataSource::Subgraph(_)))
369382
{
370-
return Err(anyhow!("Nested subgraph data sources are not supported."));
383+
return Err(anyhow!(
384+
"Nested subgraph data sources [{}] are not supported.",
385+
self.name
386+
));
371387
}
372388

373389
let mapping_entities: Vec<String> = self

store/test-store/tests/chain/ethereum/manifest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,8 @@ specVersion: 1.3.0
18541854
assert!(matches!(e, SubgraphManifestResolveError::ResolveError(_)));
18551855
let error_msg = e.to_string();
18561856
println!("{}", error_msg);
1857-
assert!(error_msg.contains("Nested subgraph data sources are not supported."));
1857+
assert!(error_msg
1858+
.contains("Nested subgraph data sources [SubgraphSource] are not supported."));
18581859
}
18591860
}
18601861
})

0 commit comments

Comments
 (0)