1use std::fmt::{Display, Formatter};
2use srp::AuthError;
3use hex::FromHexError;
4
5#[derive(Debug)]
6pub enum SimpleSrpError {
7 AuthError(AuthError),
8 FromHexError(FromHexError),
9}
10
11impl From<AuthError> for SimpleSrpError {
12 fn from(err: AuthError) -> Self {
13 SimpleSrpError::AuthError(err)
14 }
15}
16
17impl From<FromHexError> for SimpleSrpError {
18 fn from(err: FromHexError) -> Self {
19 SimpleSrpError::FromHexError(err)
20 }
21}
22
23impl Display for SimpleSrpError {
24 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
25 match self {
26 SimpleSrpError::AuthError(e) => e as &dyn Display,
27 SimpleSrpError::FromHexError(e) => e as &dyn Display,
28 }.fmt(f)
29 }
30}
31
32impl std::error::Error for SimpleSrpError {}