use std::fmt;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum FnError {
Unknown(String),
Crypto(String),
Malformed(String),
}
impl std::error::Error for FnError {}
impl From<String> for FnError {
fn from(message: String) -> Self {
Self::Unknown(message)
}
}
impl fmt::Display for FnError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::Unknown(msg) => write!(f, "[!!UNKNOWN!!] error in fn: {msg}"),
Self::Crypto(msg) => write!(f, "[Crypto] error in fn from rustls: {msg}"),
Self::Malformed(msg) => write!(f, "[Malformed] error in fn from rustls: {msg}"),
}
}
}