1#[derive(Debug, PartialEq, Clone)]
3pub struct AiidError(pub String);
4
5pub type AiidResult<T> = Result<T, AiidError>;
7
8impl std::fmt::Display for AiidError {
9 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
10 write!(f, "AiidError(\"{}\")", self.0)
11 }
12}
13
14impl std::error::Error for AiidError {}
15
16impl From<String> for AiidError {
17 fn from(error: String) -> Self {
18 Self(error)
19 }
20}
21
22impl<'a> From<&'a str> for AiidError {
23 fn from(error: &'a str) -> Self {
24 Self(error.to_string())
25 }
26}
27
28impl From<reed_solomon::DecoderError> for AiidError {
29 fn from(error: reed_solomon::DecoderError) -> Self {
30 Self(format!("{:?}", error))
31 }
32}
33
34impl From<std::num::ParseIntError> for AiidError {
35 fn from(error: std::num::ParseIntError) -> Self {
36 Self(format!("{:?}", error))
37 }
38}