Skip to main content

dx_ether_rs/errors/
ether_error.rs

1use crate::ports::ether::ether_error_port::EtherErrorPort;
2
3#[derive(serde::Serialize, serde::Deserialize)]
4pub struct EtherError {
5    pub stack: String,
6    pub message: String,
7}
8
9impl EtherError {
10    pub fn new_unknown() -> Self {
11        Self {
12            message: String::from("Something went wrong"),
13            stack: String::new(),
14        }
15    }
16}
17
18impl EtherErrorPort for EtherError {
19    fn message(&self) -> String {
20        self.message.to_string()
21    }
22
23    fn stack(&self) -> String {
24        self.stack.to_string()
25    }
26}