feat: error handling (partial)

This commit is contained in:
2025-05-11 08:15:19 +08:00
parent 949352333e
commit 12aa654935
3 changed files with 63 additions and 45 deletions

View File

@@ -9,16 +9,12 @@ use regex::Regex;
#[derive(Clone, Debug, PartialEq, Constructor)]
pub struct Catchable {
msg: Option<String>,
msg: String,
}
impl Display for Catchable {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
if let Some(ref msg) = self.msg {
write!(f, "<error: {msg}>")
} else {
write!(f, "<error>")
}
write!(f, "<error: {}>", self.msg)
}
}