1use tower::BoxError;
2
3use crate::{ExtractorError, PatternError};
4
5#[derive(Debug, thiserror::Error)]
7pub enum Error {
8 #[error(transparent)]
10 ExtractorError(#[from] ExtractorError),
11 #[error(transparent)]
13 ParsingError(#[from] ParsingError),
14 #[error(transparent)]
16 FrameError(#[from] FrameError),
17 #[error(transparent)]
19 StreamError(#[from] StreamError),
20}
21
22#[derive(Debug, thiserror::Error)]
24#[error("an error occurred while parsing data: {0}")]
25pub struct ParsingError(pub(crate) PatternError);
26
27#[derive(Debug, thiserror::Error)]
29#[error("an error occurred while creating a frame: {0}")]
30pub struct FrameError(pub(crate) String);
31
32#[derive(Debug, thiserror::Error)]
34#[error("an error occurred while working with streams: {0}")]
35pub struct StreamError(pub(crate) BoxError);
36
37impl From<Error> for crate::Frame {
38 fn from(error: Error) -> Self {
39 crate::Frame::Error(error.to_string().into())
40 }
41}