From e5444c0f8bd0ebe778debaadeea70d2fb4920e28 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Fri, 23 Feb 2024 14:03:53 +0000 Subject: [PATCH] Executor_pool: mention requested weight in error message Spotted by Yawar Amin. --- lib_eio/executor_pool.ml | 2 +- tests/executor_pool.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_eio/executor_pool.ml b/lib_eio/executor_pool.ml index 82f7e650b..5ae853178 100644 --- a/lib_eio/executor_pool.ml +++ b/lib_eio/executor_pool.ml @@ -55,7 +55,7 @@ let create ~sw ~domain_count domain_mgr = let enqueue { queue } ~weight fn = if not (weight >= 0. && weight <= 1.) (* Handles NaN *) - then Fmt.invalid_arg "Executor_pool: weight not >= 0.0 && <= 1.0" weight + then Fmt.invalid_arg "Executor_pool: weight %g not >= 0.0 && <= 1.0" weight else ( let weight = Float.to_int (weight *. max_capacity_f) in let p, w = Promise.create () in diff --git a/tests/executor_pool.md b/tests/executor_pool.md index 75245d9f3..1b7afbfdd 100644 --- a/tests/executor_pool.md +++ b/tests/executor_pool.md @@ -168,7 +168,7 @@ Must be between 0 and 1: let pool = Executor_pool.create ~sw ~domain_count:2 mgr in Executor_pool.submit_exn pool ~weight:(-5.) (fun () -> ()) ;; -Exception: Invalid_argument "Executor_pool: weight not >= 0.0 && <= 1.0". +Exception: Invalid_argument "Executor_pool: weight -5 not >= 0.0 && <= 1.0". ``` ```ocaml # run @@ fun mgr sleep duration -> @@ -176,7 +176,7 @@ Exception: Invalid_argument "Executor_pool: weight not >= 0.0 && <= 1.0". let pool = Executor_pool.create ~sw ~domain_count:2 mgr in Executor_pool.submit_exn pool ~weight:1.1 (fun () -> ()) ;; -Exception: Invalid_argument "Executor_pool: weight not >= 0.0 && <= 1.0". +Exception: Invalid_argument "Executor_pool: weight 1.1 not >= 0.0 && <= 1.0". ```