Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for unclosed items #166

Merged

Conversation

GuillaumeGomez
Copy link
Collaborator

Goes from:

error: failed to parse template source
         --> <source attribute>:4:11
       ""
  --> src/main.rs:7:14
   |
7  |       source = r#"
   |  ______________^
8  | | {% if x %}
9  | | {% if x %}
10 | | {% endif %}"#,
   | |_____________^

to:

error: expected `endif` to terminate `if` node, found nothing
         --> <source attribute>:2:2
       " if x == 1 %}\n{% if x == 2 %}\n{% endif %}\n\nbla\n"
  --> src/main.rs:7:14
   |
7  |       source = r#"
   |  ______________^
8  | | {% if x == 1 %}
9  | | {% if x == 2 %}
10 | | {% endif %}
11 | |
12 | | bla
13 | | "#,
   | |__^

Copy link
Collaborator

@Kijewski Kijewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

@Kijewski Kijewski merged commit cd57cd5 into askama-rs:master Sep 10, 2024
34 checks passed
@GuillaumeGomez GuillaumeGomez deleted the improve-unclosed-items-error branch September 10, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants