summaryrefslogtreecommitdiffstats
path: root/adenosine-pds/src/vendored/iroh_car/error.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-11-06 21:44:13 -0800
committerBryan Newbold <bnewbold@robocracy.org>2022-11-06 21:44:14 -0800
commit6111c481fac3d5c305a379b3be8afb87190db3d5 (patch)
tree4232ed843813cd9661ab16e25ccb7a05611fb2a2 /adenosine-pds/src/vendored/iroh_car/error.rs
parent40cb22e75314f73b1f9292190b786ac04fc58b67 (diff)
downloadadenosine-6111c481fac3d5c305a379b3be8afb87190db3d5.tar.gz
adenosine-6111c481fac3d5c305a379b3be8afb87190db3d5.zip
iroh-car: move vendoring into sub-module of pds crate
So we don't need to re-publish this as a separate crate.
Diffstat (limited to 'adenosine-pds/src/vendored/iroh_car/error.rs')
-rw-r--r--adenosine-pds/src/vendored/iroh_car/error.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/adenosine-pds/src/vendored/iroh_car/error.rs b/adenosine-pds/src/vendored/iroh_car/error.rs
new file mode 100644
index 0000000..3579413
--- /dev/null
+++ b/adenosine-pds/src/vendored/iroh_car/error.rs
@@ -0,0 +1,28 @@
+use thiserror::Error;
+
+/// Car utility error
+#[derive(Debug, Error)]
+pub enum Error {
+ #[error("Failed to parse CAR file: {0}")]
+ Parsing(String),
+ #[error("Invalid CAR file: {0}")]
+ InvalidFile(String),
+ #[error("Io error: {0}")]
+ Io(#[from] std::io::Error),
+ #[error("Cbor encoding error: {0}")]
+ Cbor(#[from] ipld::error::Error),
+ #[error("ld read too large {0}")]
+ LdReadTooLarge(usize),
+}
+
+impl From<cid::Error> for Error {
+ fn from(err: cid::Error) -> Error {
+ Error::Parsing(err.to_string())
+ }
+}
+
+impl From<cid::multihash::Error> for Error {
+ fn from(err: cid::multihash::Error) -> Error {
+ Error::Parsing(err.to_string())
+ }
+}