use std::io;
use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum LupinError {
#[error("Failed to read source file '{path}'")]
SourceFileRead {
path: PathBuf,
#[source]
source: io::Error,
},
#[error("Failed to read payload file '{path}'")]
PayloadFileRead {
path: PathBuf,
#[source]
source: io::Error,
},
#[error("Failed to write output file '{path}'")]
OutputFileWrite {
path: PathBuf,
#[source]
source: io::Error,
},
#[error("Failed to write to stdout")]
StdoutWrite {
#[source]
source: io::Error,
},
#[error("Engine detection failed: no suitable engine found for the input file format")]
EngineDetection {
#[source]
source: io::Error,
},
#[error("Embedding operation failed")]
EmbedFailed {
#[source]
source: io::Error,
},
#[error("Embedding operation failed. Is there already hidden data in the source file?")]
EmbedCollision {
#[source]
source: io::Error,
},
#[error("Extraction operation failed")]
ExtractFailed {
#[source]
source: io::Error,
},
#[error("Invalid PDF: no %%EOF marker found")]
PdfNoEofMarker,
#[error("No hidden data found in PDF")]
PdfNoHiddenData,
#[error("Corrupted hidden data in PDF")]
PdfCorruptedData,
#[error("Invalid PNG: no IDAT chunk found")]
PngNoIdatChunk,
#[error("No hidden data found in PNG")]
PngNoHiddenData,
#[error("Corrupted hidden data in PNG")]
PngCorruptedData,
#[error("I/O operation failed")]
Io {
#[from]
source: io::Error,
},
}
pub type Result<T> = std::result::Result<T, LupinError>;