1use std::fmt;
4
5#[derive(Debug, Clone, PartialEq)]
7pub enum FormatError {
8 FormatNotFound(String),
10 ParseError(String),
12 SerializationError(String),
14 NotSupported(String),
16}
17
18impl fmt::Display for FormatError {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 FormatError::FormatNotFound(name) => write!(f, "Format '{name}' not found"),
22 FormatError::ParseError(msg) => write!(f, "Parse error: {msg}"),
23 FormatError::SerializationError(msg) => write!(f, "Serialization error: {msg}"),
24 FormatError::NotSupported(msg) => write!(f, "Operation not supported: {msg}"),
25 }
26 }
27}
28
29impl std::error::Error for FormatError {}