use thiserror::Error;
#[derive(Debug, Error)]
pub enum FlowFileParsingError {
#[error("Incorrect flow file magic bytes, expected 'NiFiFF3' but got {0:?}")]
BadMagicBytes([u8; 7]),
#[error("Malformed flowfile: {context}: {io_error}")]
Malformed {
context: &'static str,
io_error: tokio::io::Error,
},
#[error("Broken internal flow file parsing channel: {0}")]
BrokenChannel(#[from] tokio::sync::oneshot::error::RecvError),
#[error(
"Content length of {content_length} less than flow file header indicated {flow_file_required}"
)]
ContentLengthLengthMismatch {
content_length: u64,
flow_file_required: u64,
},
#[error("A flow file was expected in the request payload.")]
FlowFileExpected,
#[error(
"A single flow file was expected in the request payload, but excess data was received."
)]
SingleFlowFileExpected,
#[error("IO error while processing flowfile: {0}")]
Io(#[from] tokio::io::Error),
}