use std::{io, path::PathBuf};
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("{} is not a file", path.display())]
NotAFileError {
path: PathBuf,
},
#[error("{msg} while operating on file {}", file.display())]
FileIo {
file: PathBuf,
msg: &'static str,
#[source]
source: io::Error,
},
#[error("File {} is detected to be type `{technique}`, but the file-{technique} feature is not enabled.", file.display())]
CompressionNotEnabled {
file: PathBuf,
technique: &'static str,
},
#[cfg(feature = "file-xz")]
#[error("Failed to initialize the xz multithreaded stream for file {}", file.display())]
XzError {
file: PathBuf,
#[source]
source: xz2::stream::Error,
},
#[cfg(feature = "async-fs")]
#[error("Failed to join Tokio task")]
JoinError {
#[from]
source: tokio::task::JoinError,
},
}
#[cfg(feature = "jsonl")]
#[allow(variant_size_differences)]
#[derive(Debug, thiserror::Error)]
pub enum MtJsonlError {
#[error("Reading the file has failed and not all entries could be read.")]
NotCompleted,
#[error(transparent)]
IoError {
#[from]
source: Error,
},
#[error("Could not parse a JSON value")]
ParsingError {
#[from]
#[source]
source: serde_json::Error,
},
}