IronForce is a decentralized network, Degeon is a messenger built on it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
994 B

use alloc::format;
use alloc::string::String;
use core::fmt::Debug;
/// An enum for all errors that may occur
#[derive(Clone, PartialEq, Debug)]
pub enum IFError {
/// An error that was created in some dependency and then converted to `IFError`
General(String),
/// A tunnel satisfying some conditions has not been found
TunnelNotFound,
3 years ago
/// Error during serialization
SerializationError(String),
/// Error in rsa
CryptoError(String),
}
3 years ago
// impl<T: Debug + core_error::Error> From<T> for IFError {
// /// Convert from other error
// fn from(e: T) -> Self {
// Self::General(format!("{:?}", e))
// }
// }
impl From<serde_cbor::Error> for IFError {
fn from(e: serde_cbor::Error) -> Self {
Self::SerializationError(format!("{:?}", e))
}
}
impl From<rsa::errors::Error> for IFError {
fn from(e: rsa::errors::Error) -> Self {
Self::CryptoError(format!("{:?}", e))
}
}
pub type IFResult<T> = Result<T, IFError>;