Tweak error messages
This commit is contained in:
parent
4a68db622d
commit
eef3633d9a
12
src/env.ml
12
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 =
|
||||
|
|
Loading…
Reference in New Issue