use tower::BoxError;
use crate::{ExtractorError, PatternError};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error(transparent)]
ExtractorError(#[from] ExtractorError),
#[error(transparent)]
ParsingError(#[from] ParsingError),
#[error(transparent)]
FrameError(#[from] FrameError),
#[error(transparent)]
StreamError(#[from] StreamError),
}
#[derive(Debug, thiserror::Error)]
#[error("an error occurred while parsing data: {0}")]
pub struct ParsingError(pub(crate) PatternError);
#[derive(Debug, thiserror::Error)]
#[error("an error occurred while creating a frame: {0}")]
pub struct FrameError(pub(crate) String);
#[derive(Debug, thiserror::Error)]
#[error("an error occurred while working with streams: {0}")]
pub struct StreamError(pub(crate) BoxError);
impl From<Error> for crate::Frame {
fn from(error: Error) -> Self {
crate::Frame::Error(error.to_string().into())
}
}