1pub type Result<T> = std::result::Result<T, Error>;
3
4#[derive(Debug, thiserror::Error)]
6pub enum Error {
7 #[error("bencode: {0}")]
9 Bencode(#[from] irontide_bencode::Error),
10
11 #[error("invalid magnet link: {0}")]
13 InvalidMagnet(String),
14
15 #[error("invalid hex: {0}")]
17 InvalidHex(String),
18
19 #[error("invalid hash length: expected {expected}, got {got}")]
21 InvalidHashLength {
22 expected: usize,
24 got: usize,
26 },
27
28 #[error("invalid torrent: {0}")]
30 InvalidTorrent(String),
31
32 #[error("io: {0}")]
34 Io(#[from] std::io::Error),
35
36 #[error("create torrent: {0}")]
38 CreateTorrent(String),
39}