1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::HOLO_HASH_PREFIX_LEN;
#[derive(thiserror::Error, Debug, Clone, PartialEq)]
pub enum HoloHashError {
#[error("Holo Hash missing 'u' prefix")]
NoU,
#[error("Holo Hash has invalid base64 encoding")]
BadBase64,
#[error("Holo Hash has incorrect size")]
BadSize,
#[error("Holo Hash {0} has unknown prefix {1:?}")]
BadPrefix(String, [u8; HOLO_HASH_PREFIX_LEN]),
#[error("Holo Hash checksum validation failed")]
BadChecksum,
}
pub type HoloHashResult<T> = Result<T, HoloHashError>;