diff options
| author | Daniil Fedotov <hairyhum@gmail.com> | 2018-08-13 14:54:10 +0100 |
|---|---|---|
| committer | Daniil Fedotov <hairyhum@gmail.com> | 2018-08-14 14:19:42 +0100 |
| commit | 61f7e9c9c3eb32441b102dbd12beb7e49a49ad0c (patch) | |
| tree | 97ccc05207a13b9cb1657c088df09b84e0b80818 | |
| parent | bcdd78881966ea2b06503e36d27438f5db2a2293 (diff) | |
| download | rabbitmq-server-git-61f7e9c9c3eb32441b102dbd12beb7e49a49ad0c.tar.gz | |
Improve the error message when a config file is not in the correct format
| -rw-r--r-- | src/rabbit_config.erl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/rabbit_config.erl b/src/rabbit_config.erl index 06801491e8..41e25d27a8 100644 --- a/src/rabbit_config.erl +++ b/src/rabbit_config.erl @@ -260,10 +260,14 @@ assert_config(Filename, Env) -> {ok, _} -> ok; {error, {1, erl_parse, Err}} -> {error, {"ERROR: Unable to parse erlang terms from ~s file: ~s~n" - "Error: ~p~n" - "Check that the file has the correct format. " - "If you are using the new ini-style format, the file " - "extension should be '.conf'~n", + "ERROR: Reason: ~p~n" + "ERROR: Check that the file is in the erlang terms format. " ++ + case Env of + "RABBITMQ_CONFIG_FILE" -> + "If you are using the new ini-style format, the file " + "extension should be '.conf'~n"; + _ -> "" + end, [Env, Filename, Err]}}; {error, Err} -> {error, {"ERROR Unable to parse erlang terms from ~s file: ~s~n" @@ -281,9 +285,9 @@ assert_conf(Filename, Env) -> true -> case file:read_file(Filename) of {ok, <<"[", _/binary>>} -> - {error, {"ERROR: wrong format of the config file ~s: ~s~n" - "Check that the file is in the new ini-style config format " - "If you are using the old format the file extension should" + {error, {"ERROR: Wrong format of the config file ~s: ~s~n" + "ERROR: Check that the file is in the new ini-style config format " + "If you are using the old format the file extension should " "be .config~n", [Env, Filename]}}; _ -> |
