File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,16 @@ Example usage
99
1010``` ocaml
1111let tmpl =
12- Mustache.of_string "Hello {{name}}\n\
13- Mustache is:\n\
14- {{#qualities}}\
15- * {{name}}\n\
16- {{/qualities}}"
12+ try
13+ Mustache.of_string "Hello {{name}}\n\
14+ Mustache is:\n\
15+ {{#qualities}}\
16+ * {{name}}\n\
17+ {{/qualities}}"
18+ with Mustache.Parse_error err ->
19+ Format.eprintf "%a@."
20+ Mustache.pp_template_parse_error err;
21+ exit 3
1722
1823let json =
1924 `O [ "name", `String "OCaml"
@@ -24,7 +29,11 @@ let json =
2429 ]
2530
2631let rendered =
27- Mustache.render tmpl json
32+ try Mustache.render tmpl json
33+ with Mustache.Render_error err ->
34+ Format.eprintf "%a@."
35+ Mustache.pp_render_error err;
36+ exit 2
2837```
2938
3039Spec compliance
You can’t perform that action at this time.
0 commit comments