1use {
2 crate::{alloc::string::ToString, cid, dag, multihash},
3 alloc::string::String,
4 thiserror_core2::Error,
5};
6
7#[derive(Debug, Error)]
9pub enum Error {
10 #[error("Failed to parse CAR file: {0}")]
11 Parsing(String),
12 #[error("Invalid CAR file: {0}")]
13 InvalidFile(String),
14 #[error("Io error: {0}")]
15 Io(#[from] core2::io::Error),
16 #[error("Cbor encoding error: {0}")]
17 Cbor(#[from] dag::error::CodecError),
18 #[error("ld read too large {0}")]
19 LdReadTooLarge(usize),
20}
21
22impl From<cid::Error> for Error {
23 fn from(err: cid::Error) -> Error {
24 Error::Parsing(err.to_string())
25 }
26}
27
28impl From<multihash::Error> for Error {
29 fn from(err: multihash::Error) -> Error {
30 Error::Parsing(err.to_string())
31 }
32}