From c6e21b50970cfd381ba5f2a9b0db646bc4b134aa Mon Sep 17 00:00:00 2001 From: gabotechs Date: Thu, 12 Oct 2023 11:04:59 +0200 Subject: [PATCH] chore: commit missing files --- graphqxl_parser/src/utils/custom_error.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 graphqxl_parser/src/utils/custom_error.rs diff --git a/graphqxl_parser/src/utils/custom_error.rs b/graphqxl_parser/src/utils/custom_error.rs new file mode 100644 index 0000000..e3bd6f8 --- /dev/null +++ b/graphqxl_parser/src/utils/custom_error.rs @@ -0,0 +1,11 @@ +use crate::parser::{Rule, RuleError}; +use pest::iterators::Pair; + +pub(crate) fn custom_error(pair: Pair, message: &str) -> Box { + Box::new(pest::error::Error::new_from_span( + pest::error::ErrorVariant::CustomError { + message: message.into(), + }, + pair.as_span(), + )) +}