Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/ppx/ppx_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ let lwt_expression mapper exp attributes =
| {pc_lhs = [%pat? exception [%p? _]]; _} -> true
| _ -> false)
in
if cases = [] then
raise (Location.Error (
Location.errorf
~loc:exp.pexp_loc
"match%%lwt must contain at least one non-exception pattern."
));
let exns =
exns |> List.map (
function
Expand Down
2 changes: 2 additions & 0 deletions test/ppx_expect/cases/match_5.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
File "match_5.ml", line 2, characters 2-81:
Error: match%lwt must contain at least one non-exception pattern.
3 changes: 3 additions & 0 deletions test/ppx_expect/cases/match_5.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let _ =
match%lwt Lwt.return () with
| exception (Invalid_argument _) -> Lwt.return 0