summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-12-06 14:16:39 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-12-06 16:18:25 +0100
commitfe37d040ee3b6d3549cd66501f2d733523216cdc (patch)
tree20e19741ae1e73e8e273dfc121d554f3ea44b0a2 /src
parent9d5425e6f69f457bf025a855a94f49e593adee31 (diff)
Add more context in error output
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r--src/client.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/client.rs b/src/client.rs
index d2a6f1e..197ac23 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -1,5 +1,6 @@
use std::convert::TryFrom;
+use anyhow::Context;
use anyhow::Result;
use futures::TryStreamExt;
use ipfs::Cid;
@@ -95,11 +96,15 @@ impl Client {
let bytes = self.ipfs
.cat_unixfs(starting_point, None)
- .await?
+ .await
+ .context("cat unixfs")?
.try_concat()
- .await?;
+ .await
+ .context("concatenating")?;
- String::from_utf8(bytes).map_err(anyhow::Error::from)
+ String::from_utf8(bytes)
+ .context("parsing UTF8")
+ .map_err(anyhow::Error::from)
}
}