1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
}
}