use std::fmt;
use std::fmt::{Display, Formatter};
#[cfg(feature = "canister")]
use candid::CandidType;
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
#[cfg_attr(feature = "canister", derive(CandidType))]
pub struct ErrorInfo {
pub code: u32,
pub message: String,
}
impl PartialEq<Self> for ErrorInfo {
fn eq(&self, other: &Self) -> bool {
self.code == other.code
}
}
impl Eq for ErrorInfo {}
impl Display for ErrorInfo {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{} {}", self.code, self.message)
}
}