textlane_core/models/
error.rs1use std::fmt;
2
3#[derive(Clone, Debug, PartialEq, Eq)]
5pub struct Error {
6 pub code: String,
7 pub message: String,
8}
9
10impl Error {
11 pub fn new(code: impl Into<String>, message: impl Into<String>) -> Self {
12 Self {
13 code: code.into(),
14 message: message.into(),
15 }
16 }
17}
18
19impl fmt::Display for Error {
20 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
21 write!(formatter, "{}: {}", self.code, self.message)
22 }
23}
24
25impl std::error::Error for Error {}