Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 980a7dd

Browse files
committed
Better outcome printer testing error message
Before, some errors during the snapshot test would be swallowed. That was confusing. See PR for screenshots.
1 parent 060e948 commit 980a7dd

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/res_test.ml

+13-3
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,19 @@ module OutcomePrinterTests = struct
159159
Typetexp.report_error env Format.str_formatter err;
160160
prerr_string (Format.flush_str_formatter ());
161161
exit 1;
162-
| _ ->
163-
prerr_string "Unknown error while trying to print outcome tree";
164-
exit 1
162+
| Typemod.Error (_, _, err) ->
163+
Typemod.report_error env Format.str_formatter err;
164+
prerr_string (Format.flush_str_formatter ());
165+
exit 1;
166+
| Typedecl.Error (_, err) ->
167+
Typedecl.report_error Format.str_formatter err;
168+
prerr_string (Format.flush_str_formatter ());
169+
exit 1;
170+
| e ->
171+
prerr_string
172+
("Unknown error while trying to print outcome tree.\n" ^
173+
"We don't display all the outcome type errors; try adding the new case to the `try` pattern match.\n");
174+
raise e
165175

166176
(* `tests/oprint/oprint.res` will be read into memory and typechecked.
167177
* The inferred signature (i.e. the type of the module `oprint.res`) will

0 commit comments

Comments
 (0)