use std::sync::PoisonError; use chumsky::prelude::Rich; use crate::lexer::Token; #[derive(Debug, PartialEq)] pub enum Error<'src> { Parse(Vec>>), Lex(Vec>), Runtime(RuntimeError), } impl<'src> From>>> for Error<'src> { fn from(errors: Vec>>) -> Self { Error::Parse(errors) } } impl<'src> From>> for Error<'src> { fn from(errors: Vec>) -> Self { Error::Lex(errors) } } impl<'src> From for Error<'src> { fn from(error: RuntimeError) -> Self { Error::Runtime(error) } } #[derive(Debug, PartialEq)] pub enum RuntimeError { RwLockPoison(RwLockPoisonError), } impl From for RuntimeError { fn from(error: RwLockPoisonError) -> Self { RuntimeError::RwLockPoison(error) } } #[derive(Debug, PartialEq)] pub struct RwLockPoisonError; impl From> for RwLockPoisonError { fn from(_: PoisonError) -> Self { RwLockPoisonError } }