Skip to content

Commit 2d3e743

Browse files
committed
graph: enhance err msg for source subgraph manifest resolution in composition
1 parent cc1f398 commit 2d3e743

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

graph/src/data_source/subgraph.rs

+25-8
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,32 @@ impl UnresolvedDataSource {
253253
let source_raw = resolver
254254
.cat(logger, &self.source.address.to_ipfs_link())
255255
.await
256-
.context("Failed to resolve source subgraph manifest")?;
256+
.context(format!(
257+
"Failed to resolve source subgraph [{}] manifest",
258+
self.source.address,
259+
))?;
257260

258-
let source_raw: serde_yaml::Mapping = serde_yaml::from_slice(&source_raw)
259-
.context("Failed to parse source subgraph manifest as YAML")?;
261+
let source_raw: serde_yaml::Mapping =
262+
serde_yaml::from_slice(&source_raw).context(format!(
263+
"Failed to parse source subgraph [{}] manifest as YAML",
264+
self.source.address
265+
))?;
260266

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

263269
let source_manifest = UnresolvedSubgraphManifest::<C>::parse(deployment_hash, source_raw)
264-
.context("Failed to parse source subgraph manifest")?;
270+
.context(format!(
271+
"Failed to parse source subgraph [{}] manifest",
272+
self.source.address
273+
))?;
265274

266275
source_manifest
267276
.resolve(resolver, logger, LATEST_VERSION.clone())
268277
.await
269-
.context("Failed to resolve source subgraph manifest")
278+
.context(format!(
279+
"Failed to resolve source subgraph [{}] manifest",
280+
self.source.address
281+
))
270282
.map(Arc::new)
271283
}
272284

@@ -292,12 +304,16 @@ impl UnresolvedDataSource {
292304
.iter()
293305
.any(|ds| matches!(ds, crate::data_source::DataSource::Subgraph(_)))
294306
{
295-
return Err(anyhow!("Nested subgraph data sources are not supported."));
307+
return Err(anyhow!(
308+
"Nested subgraph data sources [{}] are not supported.",
309+
self.name
310+
));
296311
}
297312

298313
if source_spec_version < &SPEC_VERSION_1_3_0 {
299314
return Err(anyhow!(
300-
"Source subgraph manifest spec version {} is not supported, minimum supported version is {}",
315+
"Source subgraph [{}] manifest spec version {} is not supported, minimum supported version is {}",
316+
self.source.address,
301317
source_spec_version,
302318
SPEC_VERSION_1_3_0
303319
));
@@ -310,7 +326,8 @@ impl UnresolvedDataSource {
310326

311327
if pruning_enabled {
312328
return Err(anyhow!(
313-
"Pruning is enabled for source subgraph, which is not supported"
329+
"Pruning is enabled for source subgraph [{}], which is not supported",
330+
self.source.address
314331
));
315332
}
316333

0 commit comments

Comments
 (0)