Skip to content

Commit

Permalink
improve the error message on section mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
gasche committed Dec 27, 2020
1 parent c7c6ed2 commit 9151d9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bin/test/errors/parsing-errors.t
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Mismatch between section-start and section-end:
$ mustache foo.json $PROBLEM
Template parse error:
File "foo-bar.mustache", lines 1-2, characters 23-0:
Mismatched section 'foo' with 'bar'.
Section mismatch: {{#foo}} is closed by {{/bar}}.
[3]
$ PROBLEM=foo-not-closed.mustache
Expand All @@ -113,5 +113,5 @@ Mismatch between section-start and section-end:
$ mustache foo.json $PROBLEM
Template parse error:
File "wrong-nesting.mustache", lines 1-2, characters 41-0:
Mismatched section 'foo' with 'bar'.
Section mismatch: {{#foo}} is closed by {{/bar}}.
[3]
2 changes: 1 addition & 1 deletion lib/mustache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ let pp_template_parse_error ppf ({ loc; kind; } : template_parse_error) =
| Parsing ->
p ppf "syntax error"
| Mismatched_section { start_name; end_name } ->
p ppf "Mismatched section '%a' with '%a'"
p ppf "Section mismatch: {{#%a}} is closed by {{/%a}}"
pp_dotted_name start_name
pp_dotted_name end_name
end;
Expand Down

0 comments on commit 9151d9a

Please sign in to comment.