Skip to content

Commit fb55977

Browse files
committed
improve the error message on section mismatch
1 parent 38790f1 commit fb55977

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bin/test/errors/parsing-errors.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Mismatch between section-start and section-end:
9898
$ mustache foo.json $PROBLEM
9999
Template parse error:
100100
File "foo-bar.mustache", lines 1-2, characters 23-0:
101-
Mismatched section 'foo' with 'bar'.
101+
Section mismatch: {{#foo}} is closed by {{/bar}}.
102102
[3]
103103
104104
$ PROBLEM=foo-not-closed.mustache
@@ -113,5 +113,5 @@ Mismatch between section-start and section-end:
113113
$ mustache foo.json $PROBLEM
114114
Template parse error:
115115
File "wrong-nesting.mustache", lines 1-2, characters 41-0:
116-
Mismatched section 'foo' with 'bar'.
116+
Section mismatch: {{#foo}} is closed by {{/bar}}.
117117
[3]

lib/mustache.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ let pp_template_parse_error ppf ({ loc; kind; } : template_parse_error) =
219219
| Parsing ->
220220
p ppf "syntax error"
221221
| Mismatched_section { start_name; end_name } ->
222-
p ppf "Mismatched section '%a' with '%a'"
222+
p ppf "Section mismatch: {{#%a}} is closed by {{/%a}}"
223223
pp_dotted_name start_name
224224
pp_dotted_name end_name
225225
end;

0 commit comments

Comments
 (0)