Skip to content

Commit ae1e188

Browse files
Improve error message in case too much nesting
1 parent 704c506 commit ae1e188

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rinja_parser/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -711,10 +711,10 @@ pub(crate) struct Level(u8);
711711
impl Level {
712712
fn nest(self, i: &str) -> ParseResult<'_, Level> {
713713
if self.0 >= Self::MAX_DEPTH {
714-
return Err(ErrorContext::from_err(nom::Err::Failure(error_position!(
714+
return Err(nom::Err::Failure(ErrorContext::new(
715+
"your template code is too deeply nested, or last expression is too complex",
715716
i,
716-
ErrorKind::TooLarge
717-
))));
717+
)));
718718
}
719719

720720
Ok((i, Level(self.0 + 1)))

0 commit comments

Comments
 (0)