Tweak error messages

This commit is contained in:
Jeremie Dimino 2018-03-12 11:22:54 +00:00 committed by Rudi Grinberg
parent 4a68db622d
commit eef3633d9a
1 changed files with 10 additions and 2 deletions

View File

@ -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 =