ipld_dagpb/
error.rs

1use thiserror::Error;
2
3/// Main error type.
4#[derive(Error, Debug)]
5pub enum Error {
6    /// When links are not sorted according to the spec.
7    #[error("the links are not sorted correctly")]
8    LinksWrongOrder,
9    /// When the conversion from [`ipld_core::ipld::Ipld`] to DAG-PB fails.
10    #[error("cannot convert from IPLD: {0}")]
11    FromIpld(String),
12    /// When there is an error during the buffers buffers encoding.
13    #[error("cannot encode protocol buffers")]
14    ToPb(#[from] quick_protobuf::Error),
15    /// When there is an error with the reader or writer.
16    #[error("IO error")]
17    Io(#[from] std::io::Error),
18}