From eef3633d9a42dfed03e751e6af3d2917ad566a38 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Mon, 12 Mar 2018 11:22:54 +0000 Subject: [PATCH] Tweak error messages --- src/env.ml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/env.ml b/src/env.ml index 7c7947d5..7b625243 100644 --- a/src/env.ml +++ b/src/env.ml @@ -41,10 +41,18 @@ let of_unix arr = |> List.map ~f:(fun s -> match String.lsplit2 s ~on:'=' with | None -> - Sexp.code_error "Env.of_unix doesn't support env vars without '='" + Sexp.code_error "Env.of_unix: entry without '=' found in the environ" ["var", Sexp.To_sexp.string s] | Some (k, v) -> (k, v)) - |> Map.of_list_exn + |> Map.of_list + |> function + | Ok x -> x + | Error (var, v1, v2) -> + Sexp.code_error "Env.of_unix: duplicated variable found in the environment" + [ "var" , Sexp.To_sexp.string var + ; "value1", Sexp.To_sexp.string v1 + ; "value2", Sexp.To_sexp.string v2 + ] let initial = let i =