tailwind-error 1.3.3

Tailwind Error Handlers
use crate::TailwindError;
use pest::error::{Error, ErrorVariant};
use std::fmt::Debug;

impl<R> From<Error<R>> for TailwindError
where
    R: Debug,
{
    fn from(e: Error<R>) -> Self {
        let error = Self::from(e.variant);
        error
    }
}

impl<R> From<ErrorVariant<R>> for TailwindError
where
    R: Debug,
{
    fn from(e: ErrorVariant<R>) -> Self {
        let msg = match e {
            ErrorVariant::ParsingError { positives, negatives } => {
                format!("Positive attempts: {:?}\nNegative attempts: {:?}", positives, negatives)
            },
            ErrorVariant::CustomError { message } => message,
        };
        Self::syntax_error(msg)
    }
}