use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("Unsupported type: {0}")]
UnsupportedType(String),
#[error("Invalid identifier: {0}")]
InvalidIdentifier(String),
#[error("Circular reference detected")]
CircularReference,
#[error("Generic constraint error: {0}")]
GenericConstraint(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Configuration error: {0}")]
Configuration(String),
#[error("Format error: {message}: {source}")]
Format {
message: &'static str,
source: specta::FormatError,
},
}
impl Error {
pub(crate) fn format(message: &'static str, source: specta::FormatError) -> Self {
Self::Format { message, source }
}
}