diff --git a/src/dune_engine/action.ml b/src/dune_engine/action.ml index 4f61d473613..eef817bb9f6 100644 --- a/src/dune_engine/action.ml +++ b/src/dune_engine/action.ml @@ -70,19 +70,10 @@ module Prog = struct let create ?hint ~context ~program ~loc () = { hint; context; program; loc } - let user_message { context; program; hint; loc } = - let hint = - match program with - | "refmt" -> Some (Option.value ~default:"opam install reason" hint) - | "rescript_syntax" -> - Some (Option.value ~default:"opam install rescript-syntax" hint) - | _ -> hint - in - Utils.program_not_found_message ?hint ~loc ~context program + let raise { context; program; hint; loc } = + raise (User_error.E (Utils.program_not_found_message ?hint ~loc ~context program)) ;; - let raise t = raise (User_error.E (user_message t)) - let to_dyn { context; program; hint; loc = _ } = let open Dyn in record diff --git a/src/dune_rules/action_unexpanded.ml b/src/dune_rules/action_unexpanded.ml index 0a009be9a91..eb225e9df4e 100644 --- a/src/dune_rules/action_unexpanded.ml +++ b/src/dune_rules/action_unexpanded.ml @@ -405,7 +405,13 @@ end = struct then Artifacts.Original_path else Install_dir and* artifacts = Expander.artifacts env.expander in - Artifacts.binary ~loc:(Some loc) ~where artifacts s) + let hint = + match s with + | "refmt" -> Some "opam install reason" + | "rescript_syntax" -> Some "opam install rescript-syntax" + | _ -> None + in + Artifacts.binary ?hint ~loc:(Some loc) ~where artifacts s) in let prog = Result.map prog ~f:(Expander.map_exe env.expander) in let args = Value.L.to_strings ~dir args in