aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_app_discovery.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2014-11-09 18:22:20 -0600
committerTristan Sloughter <[email protected]>2014-11-09 19:50:35 -0600
commitbf953e417d0771583d95d4d6b6e2697ab44754d6 (patch)
tree2bb652df3be9f3e2b4187bf073672dad4f7dda10 /src/rlx_app_discovery.erl
parent64b946e351a92bd2686d0a4370c252a53eaa82bd (diff)
downloadrelx-bf953e417d0771583d95d4d6b6e2697ab44754d6.tar.gz
relx-bf953e417d0771583d95d4d6b6e2697ab44754d6.tar.bz2
relx-bf953e417d0771583d95d4d6b6e2697ab44754d6.zip
move back to using format_error/1
Diffstat (limited to 'src/rlx_app_discovery.erl')
-rw-r--r--src/rlx_app_discovery.erl38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/rlx_app_discovery.erl b/src/rlx_app_discovery.erl
index 2c5714b..6ac8d11 100644
--- a/src/rlx_app_discovery.erl
+++ b/src/rlx_app_discovery.erl
@@ -25,7 +25,7 @@
-module(rlx_app_discovery).
-export([do/2,
- format_error/2]).
+ format_error/1]).
-include("relx.hrl").
@@ -44,10 +44,10 @@ do(State, LibDirs) ->
end),
resolve_app_metadata(State, LibDirs).
--spec format_error([ErrorDetail::term()], rlx_state:t()) -> iolist().
-format_error(ErrorDetails, State)
+-spec format_error([ErrorDetail::term()]) -> iolist().
+format_error(ErrorDetails)
when erlang:is_list(ErrorDetails) ->
- [[format_detail(ErrorDetail, State), "\n"] || ErrorDetail <- ErrorDetails].
+ [[format_detail(ErrorDetail), "\n"] || ErrorDetail <- ErrorDetails].
%%%===================================================================
%%% Internal Functions
@@ -85,10 +85,10 @@ get_app_metadata(State, LibDirs) ->
{ok, _} = AppMeta ->
[AppMeta|Acc];
{warning, W} ->
- ec_cmd_log:warn(rlx_state:log(State), format_detail(W, State)),
+ ec_cmd_log:warn(rlx_state:log(State), format_detail(W)),
Acc;
{error, E} ->
- ec_cmd_log:error(rlx_state:log(State), format_detail(E, State)),
+ ec_cmd_log:error(rlx_state:log(State), format_detail(E)),
Acc;
_ ->
Acc
@@ -111,7 +111,7 @@ resolve_app_metadata(State, LibDirs) ->
{error, _} ->
true;
{warning, W} ->
- ec_cmd_log:warn(rlx_state:log(State), format_detail(W, State)),
+ ec_cmd_log:warn(rlx_state:log(State), format_detail(W)),
false;
_ ->
false
@@ -155,30 +155,30 @@ resolve_override(AppName, FileName0) ->
{ok, rlx_app_info:link(App, true)}
end.
--spec format_detail(ErrorDetail::term(), rlx_state:t()) -> iolist().
-format_detail({missing_beam_file, Module, BeamFile}, _) ->
+-spec format_detail(ErrorDetail::term()) -> iolist().
+format_detail({missing_beam_file, Module, BeamFile}) ->
io_lib:format("Missing beam file ~p ~p", [Module, BeamFile]);
-format_detail({error, {invalid_override, AppName, FileName}}, _) ->
+format_detail({error, {invalid_override, AppName, FileName}}) ->
io_lib:format("Override {~p, ~p} is not a valid OTP App. Perhaps you forgot to build it?",
[AppName, FileName]);
-format_detail({accessing, File, eaccess}, _) ->
+format_detail({accessing, File, eaccess}) ->
io_lib:format("permission denied accessing file ~s", [File]);
-format_detail({accessing, File, Type}, _) ->
+format_detail({accessing, File, Type}) ->
io_lib:format("error (~p) accessing file ~s", [Type, File]);
-format_detail({no_beam_files, EbinDir}, _) ->
+format_detail({no_beam_files, EbinDir}) ->
io_lib:format("no beam files found in directory ~s", [EbinDir]);
-format_detail({not_a_directory, EbinDir}, _) ->
+format_detail({not_a_directory, EbinDir}) ->
io_lib:format("~s is not a directory when it should be a directory", [EbinDir]);
-format_detail({unable_to_load_app, AppDir, _}, _) ->
+format_detail({unable_to_load_app, AppDir, _}) ->
io_lib:format("Unable to load the application metadata from ~s", [AppDir]);
-format_detail({invalid_app_file, File}, _) ->
+format_detail({invalid_app_file, File}) ->
io_lib:format("Application metadata file exists but is malformed: ~s",
[File]);
-format_detail({unversioned_app, AppDir, _AppName}, _) ->
+format_detail({unversioned_app, AppDir, _AppName}) ->
io_lib:format("Application metadata exists but version is not available: ~s",
[AppDir]);
-format_detail({app_info_error, {Module, Detail}}, State) ->
- Module:format_error(Detail, State).
+format_detail({app_info_error, {Module, Detail}}) ->
+ Module:format_error(Detail).
-spec discover_dir([file:name()], directory | file) ->
{ok, rlx_app_info:t()} | {error, Reason::term()}.