diff --git a/src/error/error.rs b/src/error/error.rs index d6a882c..8032a25 100644 --- a/src/error/error.rs +++ b/src/error/error.rs @@ -4,10 +4,9 @@ use nom::IResult; pub(crate) type Res = IResult>; -// TODO: MyError probably shouldn't be based on the same type as the input type since it's used exclusively with static strings right now. #[derive(Debug)] pub enum CustomError { - MyError(MyError), + MyError(MyError<&'static str>), Nom(I, ErrorKind), IO(std::io::Error), } @@ -31,3 +30,9 @@ impl From for CustomError { CustomError::IO(value) } } + +impl From<&'static str> for CustomError { + fn from(value: &'static str) -> Self { + CustomError::MyError(MyError(value)) + } +}