From df65be07e401d759ed9e8faf211bc20f7e8fbf53 Mon Sep 17 00:00:00 2001 From: Mingun Date: Thu, 4 Jul 2024 20:55:12 +0500 Subject: [PATCH] Fix incorrect `.error_position()` when encountering syntax error for open or self-closed tag --- Changelog.md | 1 + src/reader/mod.rs | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index c15a19fd..35b51fc1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,6 +19,7 @@ - [#781]: Fix conditions to start CDATA section. Only uppercase ` $self.state.emit_bang(bang_type, bytes), Err(e) => { - // Ok($self.state.emit_start(bytes)), - Err(e) => Err(e), + Err(e) => { + // We want to report error at `<`, but offset was increased, + // so return it back (-1 for `<`) + $self.state.last_error_offset = start - 1; + Err(e) + } }, // `<` - syntax error, tag not closed Ok(None) => {