Skip to content

Commit 26683ef

Browse files
committed
fix: return error instead of panicking if fetching from ipfs fails
1 parent e029e25 commit 26683ef

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

crates/dips/src/ipfs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl IpfsFetcher for IpfsClient {
5050
.map_ok(|chunk| chunk.to_vec())
5151
.try_concat()
5252
.await
53-
.unwrap();
53+
.map_err(|_| DipsError::SubgraphManifestUnavailable(file.to_string()))?;
5454

5555
let manifest: GraphManifest = serde_yaml::from_slice(&content)
5656
.map_err(|_| DipsError::InvalidSubgraphManifest(file.to_string()))?;

crates/dips/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ pub enum DipsError {
139139
PayerNotAuthorised(Address),
140140
#[error("voucher payee {actual} does not match the expected address {expected}")]
141141
UnexpectedPayee { expected: Address, actual: Address },
142+
#[error("cannot get subgraph manifest for {0}")]
143+
SubgraphManifestUnavailable(String),
142144
#[error("invalid subgraph id {0}")]
143145
InvalidSubgraphManifest(String),
144146
#[error("voucher for chain id {0}, subgraph manifest has network {1}")]

0 commit comments

Comments
 (0)