feast/pass/
error.rs

1use super::{Context, ContextToken};
2use crate::input;
3
4use std::fmt::Debug;
5
6pub trait Error<'i>: Debug + 'i {
7    type Context: Context<'i>;
8    type InputError: input::Error<'i, Token = ContextToken<'i, Self::Context>>;
9
10    // Create pass error from input error.
11    fn from_input(ctx: Self::Context, err: Self::InputError) -> Self;
12}
13
14#[derive(Clone, Debug, PartialEq)]
15pub struct VerboseError<'i, C>
16where
17    C: Context<'i>,
18{
19    ctx: C,
20    input: input::VerboseError<'i, ContextToken<'i, C>>,
21}
22
23impl<'i, C> Error<'i> for VerboseError<'i, C>
24where
25    C: Context<'i>,
26{
27    type Context = C;
28    type InputError = input::VerboseError<'i, ContextToken<'i, C>>;
29
30    fn from_input(ctx: Self::Context, err: Self::InputError) -> Self {
31        VerboseError { ctx, input: err }
32    }
33}