File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ let[@inline] discontinue k exn =
3939 let bt = Printexc. get_raw_backtrace () in
4040 Effect.Deep. discontinue_with_backtrace k exn bt
4141
42+ let [@ inline] raise_with_bt exn =
43+ let bt = Printexc. get_raw_backtrace () in
44+ Printexc. raise_with_backtrace exn bt
45+
4246let with_handler (type st arg ) ~(ops : st ops ) (self : st ) :
4347 (unit -> unit ) -> unit =
4448 let current =
@@ -93,7 +97,7 @@ let with_handler (type st arg) ~(ops : st ops) (self : st) :
9397 discontinue k exn )
9498 | _ -> None
9599 in
96- let handler = Effect.Deep. { retc = Fun. id; exnc = raise ; effc } in
100+ let handler = Effect.Deep. { retc = Fun. id; exnc = raise_with_bt ; effc } in
97101 fun f -> Effect.Deep. match_with f () handler
98102
99103[@@@ else_]
@@ -145,7 +149,8 @@ let worker_loop (type st) ~block_signals ~(ops : st ops) (self : st) : unit =
145149 (* this is already in an effect handler *)
146150 k ()
147151 with e ->
148- let ebt = Exn_bt. get e in
152+ let bt = Printexc. get_raw_backtrace () in
153+ let ebt = Exn_bt. make e bt in
149154 ops.on_exn self ebt);
150155
151156 after_task runner _ctx;
You can’t perform that action at this time.
0 commit comments