mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 11:15:38 -05:00
fix core: better repropagating of errors
This commit is contained in:
parent
eba239487c
commit
867cbd2318
1 changed files with 7 additions and 2 deletions
|
|
@ -39,6 +39,10 @@ let[@inline] discontinue k exn =
|
||||||
let bt = Printexc.get_raw_backtrace () in
|
let bt = Printexc.get_raw_backtrace () in
|
||||||
Effect.Deep.discontinue_with_backtrace k exn bt
|
Effect.Deep.discontinue_with_backtrace k exn bt
|
||||||
|
|
||||||
|
let[@inline] raise_with_bt exn =
|
||||||
|
let bt = Printexc.get_raw_backtrace () in
|
||||||
|
Printexc.raise_with_backtrace exn bt
|
||||||
|
|
||||||
let with_handler (type st arg) ~(ops : st ops) (self : st) :
|
let with_handler (type st arg) ~(ops : st ops) (self : st) :
|
||||||
(unit -> unit) -> unit =
|
(unit -> unit) -> unit =
|
||||||
let current =
|
let current =
|
||||||
|
|
@ -93,7 +97,7 @@ let with_handler (type st arg) ~(ops : st ops) (self : st) :
|
||||||
discontinue k exn)
|
discontinue k exn)
|
||||||
| _ -> None
|
| _ -> None
|
||||||
in
|
in
|
||||||
let handler = Effect.Deep.{ retc = Fun.id; exnc = raise; effc } in
|
let handler = Effect.Deep.{ retc = Fun.id; exnc = raise_with_bt; effc } in
|
||||||
fun f -> Effect.Deep.match_with f () handler
|
fun f -> Effect.Deep.match_with f () handler
|
||||||
|
|
||||||
[@@@else_]
|
[@@@else_]
|
||||||
|
|
@ -145,7 +149,8 @@ let worker_loop (type st) ~block_signals ~(ops : st ops) (self : st) : unit =
|
||||||
(* this is already in an effect handler *)
|
(* this is already in an effect handler *)
|
||||||
k ()
|
k ()
|
||||||
with e ->
|
with e ->
|
||||||
let ebt = Exn_bt.get e in
|
let bt = Printexc.get_raw_backtrace () in
|
||||||
|
let ebt = Exn_bt.make e bt in
|
||||||
ops.on_exn self ebt);
|
ops.on_exn self ebt);
|
||||||
|
|
||||||
after_task runner _ctx;
|
after_task runner _ctx;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue