use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
#[error("invalid data content: {message}")]
pub struct InvalidDataContentError {
pub message: String,
#[source]
pub cause: Option<Box<dyn std::error::Error + Send + Sync>>,
}
impl InvalidDataContentError {
#[must_use]
pub fn new(message: impl Into<String>) -> Self {
Self {
message: message.into(),
cause: None,
}
}
#[must_use]
pub fn with_cause(mut self, cause: impl std::error::Error + Send + Sync + 'static) -> Self {
self.cause = Some(Box::new(cause));
self
}
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum FileSourceError {
#[error(transparent)]
InvalidDataContent(#[from] InvalidDataContentError),
#[error("file source path `{}` must be read before conversion", path.display())]
UnreadPath {
path: PathBuf,
},
}