瀏覽代碼

Display error message when bad config is loaded

If a bad configuration file is submitted to rebar3 shell, display the
following error:

    ===> The configuration file submitted could not be read and will be
    ignored.

And keep going otherwise rather than silently failing.

While crash-fast is usually a good mechanism, the shell so far is very
tolerant of failures from apps to boot and whatnot, so this feels
appropriate.

Fixes #1019
pull/1022/head
Fred Hebert 9 年之前
父節點
當前提交
50307a6aa9
共有 1 個檔案被更改,包括 7 行新增2 行删除
  1. +7
    -2
      src/rebar_prv_shell.erl

+ 7
- 2
src/rebar_prv_shell.erl 查看文件

@ -325,9 +325,14 @@ reread_config(State) ->
no_config ->
ok;
ConfigList ->
_ = [application:set_env(Application, Key, Val)
try
[application:set_env(Application, Key, Val)
|| {Application, Items} <- ConfigList,
{Key, Val} <- Items],
{Key, Val} <- Items]
catch _:_ ->
?ERROR("The configuration file submitted could not be read "
"and will be ignored.", [])
end,
ok
end.

Loading…
取消
儲存