From 04589cf963028c75abd531892b1dcc54dae621b3 Mon Sep 17 00:00:00 2001 From: vans163 Date: Sat, 3 Sep 2016 10:35:26 -0400 Subject: log error if a module failed to load_file, the user should be aware --- src/rebar_agent.erl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/rebar_agent.erl b/src/rebar_agent.erl index 8e1c8f6..2d83683 100644 --- a/src/rebar_agent.erl +++ b/src/rebar_agent.erl @@ -142,7 +142,9 @@ reload_modules(Modules, true) -> on_load_not_allowed -> reload_modules([ModError], false), [ModError|Acc]; - _ -> [ModError|Acc] + _ -> + ?ERROR("Module ~p failed to atomic load because ~p", [ModError, Error]), + [ModError|Acc] end end, [], ModRsns @@ -152,4 +154,13 @@ reload_modules(Modules, true) -> %% Older versions, use a more ad-hoc mechanism. reload_modules(Modules, false) -> - [begin code:delete(M), code:purge(M), code:load_file(M) end || M <- Modules]. + lists:foreach(fun(M) -> + code:delete(M), + code:purge(M), + case code:load_file(M) of + {module, M} -> ok; + {error, Error} -> + ?ERROR("Module ~p failed to load because ~p", [M, Error]) + end + end, Modules + ). \ No newline at end of file -- cgit v1.1 From 9ab25aaf1508e4286d755a0a60d6d22728a46dbf Mon Sep 17 00:00:00 2001 From: vans163 Date: Sat, 3 Sep 2016 15:56:38 -0400 Subject: replace error with debug --- src/rebar_agent.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rebar_agent.erl b/src/rebar_agent.erl index 2d83683..4b0fc5f 100644 --- a/src/rebar_agent.erl +++ b/src/rebar_agent.erl @@ -143,7 +143,7 @@ reload_modules(Modules, true) -> reload_modules([ModError], false), [ModError|Acc]; _ -> - ?ERROR("Module ~p failed to atomic load because ~p", [ModError, Error]), + ?DEBUG("Module ~p failed to atomic load because ~p", [ModError, Error]), [ModError|Acc] end end, @@ -160,7 +160,7 @@ reload_modules(Modules, false) -> case code:load_file(M) of {module, M} -> ok; {error, Error} -> - ?ERROR("Module ~p failed to load because ~p", [M, Error]) + ?DEBUG("Module ~p failed to load because ~p", [M, Error]) end end, Modules ). \ No newline at end of file -- cgit v1.1