mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
fix: catch TLS.Not_set
This commit is contained in:
parent
704ebdae58
commit
3193a259ad
1 changed files with 6 additions and 1 deletions
|
|
@ -27,8 +27,13 @@ let[@inline] get_current_fiber () : fiber option =
|
||||||
match TLS.get_exn k_cur_fiber with
|
match TLS.get_exn k_cur_fiber with
|
||||||
| f when f != _dummy_fiber -> Some f
|
| f when f != _dummy_fiber -> Some f
|
||||||
| _ -> None
|
| _ -> None
|
||||||
|
| exception TLS.Not_set -> None
|
||||||
|
|
||||||
|
let error_get_current_fiber_ =
|
||||||
|
"Moonpool: get_current_fiber was called outside of a fiber."
|
||||||
|
|
||||||
let[@inline] get_current_fiber_exn () : fiber =
|
let[@inline] get_current_fiber_exn () : fiber =
|
||||||
match TLS.get_exn k_cur_fiber with
|
match TLS.get_exn k_cur_fiber with
|
||||||
| f when f != _dummy_fiber -> f
|
| f when f != _dummy_fiber -> f
|
||||||
| _ -> failwith "Moonpool: get_current_fiber was called outside of a fiber."
|
| _ -> failwith error_get_current_fiber_
|
||||||
|
| exception TLS.Not_set -> failwith error_get_current_fiber_
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue