1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5 #[error("Connection failed")]
6 ConnectionFailed,
7 #[error("Connection closed")]
8 ConnectionClosed,
9 #[error("Operation timed out")]
10 Timeout,
11 #[error("Received a NACK for Interest")]
12 NackReceived,
13 #[error("Verification failed")]
14 VerificationFailed,
15 #[error("IO Error")]
16 IOError(std::io::Error),
17 #[error("Other error")]
18 Other(String),
19}
20
21impl From<std::io::Error> for Error {
22 fn from(value: std::io::Error) -> Self {
23 Self::IOError(value)
24 }
25}
26
27impl From<tokio::time::error::Elapsed> for Error {
28 fn from(_: tokio::time::error::Elapsed) -> Self {
29 Self::Timeout
30 }
31}