wide_log/error.rs
1/// Errors that can occur during wide-event operations.
2#[derive(Debug, thiserror::Error)]
3#[non_exhaustive]
4pub enum Error {
5 /// Serialization of a wide event to JSON failed.
6 #[error("serialization failed: {0}")]
7 Serialize(String),
8}
9
10#[cfg(test)]
11mod tests {
12 use super::*;
13
14 #[test]
15 fn error_display() {
16 let e = Error::Serialize("bad input".into());
17 assert_eq!(e.to_string(), "serialization failed: bad input");
18 }
19
20 #[test]
21 fn error_is_debug() {
22 let e = Error::Serialize("y".into());
23 let s = format!("{:?}", e);
24 assert!(s.contains("Serialize"));
25 }
26}