@@ -255,38 +255,46 @@ assert_config(none, _) -> ok;
255255assert_config (Filename , Env ) ->
256256 assert_config (filename :extension (Filename ), Filename , Env ).
257257
258+ -define (ERRMSG_INDENT , " " ).
259+
258260assert_config (" .config" , Filename , Env ) ->
259261 case filelib :is_regular (Filename ) of
260262 true ->
261263 case file :consult (Filename ) of
262264 {ok , []} -> {error ,
263- {" ERROR: Config file ~s should not be empty: ~s " ,
265+ {" Config file ~s should not be empty: ~s " ,
264266 [Env , Filename ]}};
265267 {ok , [_ ]} -> ok ;
266268 {ok , [_ |_ ]} -> {error ,
267- {" ERROR: Config file ~s must contain ONE list ended by <dot>: ~s " ,
269+ {" Config file ~s must contain ONE list ended by <dot>: ~s " ,
268270 [Env , Filename ]}};
269271 {error , {1 , erl_parse , Err }} ->
270- {error , {" ERROR: Unable to parse erlang terms from ~s file: ~s~n "
271- " ERROR: Reason: ~p~n "
272- " ERROR: Check that the file is in the erlang terms format. " ++
272+ % Note: the sequence of spaces is to indent from the [error] prefix, like this:
273+ %
274+ % 2018-09-06 07:05:40.225 [error] Unable to parse erlang terms from RABBITMQ_ADVANCED_CONFIG_FILE...
275+ % Reason: ["syntax error before: ",[]]
276+ {error , {" Unable to parse erlang terms from ~s file: ~s~n "
277+ ? ERRMSG_INDENT
278+ " Reason: ~p~n "
279+ ? ERRMSG_INDENT
280+ " Check that the file is in erlang term format. " ++
273281 case Env of
274282 " RABBITMQ_CONFIG_FILE" ->
275- " If you are using the new ini-style format, the file "
276- " extension should be '.conf'~n " ;
283+ " If you are using the new ini-style format, the file extension should be '.conf'~n " ;
277284 _ -> " "
278285 end ,
279286 [Env , Filename , Err ]}};
280287 {error , Err } ->
281- {error , {" ERROR Unable to parse erlang terms from ~s file: ~s~n "
288+ {error , {" Unable to parse erlang terms from ~s file: ~s~n "
289+ ? ERRMSG_INDENT
282290 " Error: ~p~n " ,
283291 [Env , Filename , Err ]}}
284292 end ;
285293 false ->
286294 ok
287295 end ;
288296assert_config (BadExt , Filename , Env ) ->
289- {error , {" ERROR: '~s ': Expected extension '.config', got extension '~s ' for file '~s '~n " , [Env , BadExt , Filename ]}}.
297+ {error , {" '~s ': Expected extension '.config', got extension '~s ' for file '~s '~n " , [Env , BadExt , Filename ]}}.
290298
291299assert_conf (" " , _ ) -> ok ;
292300assert_conf (Filename , Env ) ->
@@ -298,8 +306,9 @@ assert_conf(".conf", Filename, Env) ->
298306 case file :consult (Filename ) of
299307 {ok , []} -> ok ;
300308 {ok , _ } ->
301- {error , {" ERROR: Wrong format of the config file ~s : ~s~n "
302- " ERROR: Check that the file is in the new ini-style config format "
309+ {error , {" Wrong format of the config file ~s : ~s~n "
310+ ? ERRMSG_INDENT
311+ " Check that the file is in the new ini-style config format. "
303312 " If you are using the old format the file extension should "
304313 " be .config~n " ,
305314 [Env , Filename ]}};
@@ -310,4 +319,4 @@ assert_conf(".conf", Filename, Env) ->
310319 ok
311320 end ;
312321assert_conf (BadExt , Filename , Env ) ->
313- {error , {" ERROR: '~s ': Expected extension '.config', got extension '~s ' for file '~s '~n " , [Env , BadExt , Filename ]}}.
322+ {error , {" '~s ': Expected extension '.config', got extension '~s ' for file '~s '~n " , [Env , BadExt , Filename ]}}.
0 commit comments