valkyrie_errors/errors/
display.rs

1use std::{
2    error::Error,
3    fmt::{Debug, Display, Formatter},
4};
5
6use crate::{ValkyrieError, ValkyrieErrorKind};
7
8impl Error for ValkyrieError {}
9
10impl Debug for ValkyrieError {
11    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
12        match &self.kind {
13            ValkyrieErrorKind::Duplicate(e) => Debug::fmt(e, f),
14            ValkyrieErrorKind::Runtime(e) => Debug::fmt(e, f),
15            ValkyrieErrorKind::Parsing(e) => Debug::fmt(e, f),
16        }
17    }
18}
19
20impl Display for ValkyrieError {
21    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
22        match &self.kind {
23            ValkyrieErrorKind::Duplicate(e) => Display::fmt(e, f),
24            ValkyrieErrorKind::Runtime(e) => Display::fmt(e, f),
25            ValkyrieErrorKind::Parsing(e) => Display::fmt(e, f),
26        }
27    }
28}