Skip to content

Commit 4d98a0a

Browse files
raphael-proustsmorimoto
authored andcommitted
Use reraise instead of fail in more places in ppx
1 parent 3bfbb5c commit 4d98a0a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/ppx/ppx_lwt.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let add_wildcard_case cases =
2323
if not has_wildcard
2424
then cases
2525
@ (let loc = Location.none in
26-
[case ~lhs:[%pat? exn] ~guard:None ~rhs:[%expr Lwt.fail exn]])
26+
[case ~lhs:[%pat? exn] ~guard:None ~rhs:[%expr Lwt.reraise exn]])
2727
else cases
2828

2929
(** {3 Internal names} *)
@@ -154,11 +154,11 @@ let lwt_expression mapper exp attributes ext_loc =
154154
Some (mapper#expression { new_exp with pexp_attributes })
155155

156156
(* [assert%lwt $e$] ≡
157-
[try Lwt.return (assert $e$) with exn -> Lwt.fail exn] *)
157+
[try Lwt.return (assert $e$) with exn -> Lwt.reraise exn] *)
158158
| Pexp_assert e ->
159159
let new_exp =
160160
let loc = !default_loc in
161-
[%expr try Lwt.return (assert [%e e]) with exn -> Lwt.fail exn]
161+
[%expr try Lwt.return (assert [%e e]) with exn -> Lwt.reraise exn]
162162
in
163163
Some (mapper#expression { new_exp with pexp_attributes })
164164

src/ppx/ppx_lwt.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ catch (fun () -> f x)
8080
prerr_endline msg;
8181
return ()
8282
| exn ->
83-
Lwt.fail exn)
83+
Lwt.reraise exn)
8484
]}
8585
86-
Note that the [exn -> Lwt.fail exn] branch is automatically added
86+
Note that the [exn -> Lwt.reraise exn] branch is automatically added
8787
when needed.
8888
8989
- finalizer:

0 commit comments

Comments
 (0)