aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_prv_overlay.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_prv_overlay.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_prv_overlay.erl')
-rw-r--r--src/rlx_prv_overlay.erl54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index 6df142b..f7e2be8 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -26,7 +26,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-define(DIRECTORY_RE, ".*(\/|\\\\)$").
@@ -66,40 +66,40 @@ do(State) ->
?RLX_ERROR({unresolved_release, RelName, RelVsn})
end.
--spec format_error(ErrorDetail::term(), rlx_state:t()) -> iolist().
-format_error({unresolved_release, RelName, RelVsn}, _) ->
+-spec format_error(ErrorDetail::term()) -> iolist().
+format_error({unresolved_release, RelName, RelVsn}) ->
io_lib:format("The release has not been resolved ~p-~s", [RelName, RelVsn]);
-format_error({ec_file_error, AppDir, TargetDir, E}, _) ->
+format_error({ec_file_error, AppDir, TargetDir, E}) ->
io_lib:format("Unable to copy OTP App from ~s to ~s due to ~p",
[AppDir, TargetDir, E]);
-format_error({unable_to_read_varsfile, FileName, Reason}, _) ->
+format_error({unable_to_read_varsfile, FileName, Reason}) ->
io_lib:format("Unable to read vars file (~s) for overlay due to: ~p",
[FileName, Reason]);
-format_error({overlay_failed, Errors}, State) ->
- [[format_error(rlx_util:error_reason(Error), State), "\n"] || Error <- Errors];
-format_error({dir_render_failed, Dir, Error}, _) ->
+format_error({overlay_failed, Errors}) ->
+ [[format_error(rlx_util:error_reason(Error)), "\n"] || Error <- Errors];
+format_error({dir_render_failed, Dir, Error}) ->
io_lib:format("rendering mkdir path failed ~s with ~p",
[Dir, Error]);
-format_error({unable_to_make_symlink, AppDir, TargetDir, Reason}, _) ->
+format_error({unable_to_make_symlink, AppDir, TargetDir, Reason}) ->
io_lib:format("Unable to symlink directory ~s to ~s because \n~s~s",
[AppDir, TargetDir, rlx_util:indent(2),
file:format_error(Reason)]);
-format_error({copy_failed, FromFile, ToFile, Err}, _) ->
+format_error({copy_failed, FromFile, ToFile, Err}) ->
io_lib:format("Unable to copy from ~s to ~s because of ~p",
[FromFile, ToFile, Err]);
-format_error({unable_to_write, ToFile, Reason}, _) ->
+format_error({unable_to_write, ToFile, Reason}) ->
io_lib:format("Unable to write to ~s because ~p",
[ToFile, Reason]);
-format_error({unable_to_enclosing_dir, ToFile, Reason}, _) ->
+format_error({unable_to_enclosing_dir, ToFile, Reason}) ->
io_lib:format("Unable to create enclosing directory for ~s because ~p",
[ToFile, Reason]);
-format_error({unable_to_render_template, FromFile, Reason}, _) ->
+format_error({unable_to_render_template, FromFile, Reason}) ->
io_lib:format("Unable to render template ~s because ~p",
[FromFile, Reason]);
-format_error({unable_to_compile_template, FromFile, Reason}, State) ->
+format_error({unable_to_compile_template, FromFile, Reason}) ->
io_lib:format("Unable to compile template ~s because \n~s",
- [FromFile, [format_errors(F, Es, State) || {F, Es} <- Reason]]);
-format_error({unable_to_make_dir, Absolute, Error}, _) ->
+ [FromFile, [format_errors(F, Es) || {F, Es} <- Reason]]);
+format_error({unable_to_make_dir, Absolute, Error}) ->
io_lib:format("Unable to make directory ~s because ~p",
[Absolute, Error]).
@@ -107,22 +107,22 @@ format_error({unable_to_make_dir, Absolute, Error}, _) ->
%%% Internal Functions
%%%===================================================================
-format_errors(File, [{none, Mod, E}|Es], State) ->
+format_errors(File, [{none, Mod, E}|Es]) ->
[io_lib:format("~s~s: ~ts~n",
[rlx_util:indent(2), File,
- Mod:format_error(E, State)])
- |format_errors(File, Es, State)];
-format_errors(File, [{{Line, Col}, Mod, E}|Es], State) ->
+ Mod:format_error(E)])
+ |format_errors(File, Es)];
+format_errors(File, [{{Line, Col}, Mod, E}|Es]) ->
[io_lib:format("~s~s:~w:~w: ~ts~n",
[rlx_util:indent(2), File, Line, Col,
- Mod:format_error(E, State)])
- |format_errors(File, Es, State)];
-format_errors(File, [{Line, Mod, E}|Es], State) ->
+ Mod:format_error(E)])
+ |format_errors(File, Es)];
+format_errors(File, [{Line, Mod, E}|Es]) ->
[io_lib:format("~s~s:~w: ~ts~n",
[rlx_util:indent(2), File, Line,
- Mod:format_error(E, State)])
- |format_errors(File, Es, State)];
-format_errors(_, [], _State) -> [].
+ Mod:format_error(E)])
+ |format_errors(File, Es)];
+format_errors(_, []) -> [].
-spec generate_overlay_vars(rlx_state:t(), rlx_release:t()) ->
@@ -168,7 +168,7 @@ merge_overlay_vars(State, FileNames) ->
lists:ukeymerge(1, lists:ukeysort(1, Terms), Acc);
{error, Reason} ->
ec_cmd_log:warn(rlx_state:log(State),
- format_error({unable_to_read_varsfile, FileName, Reason}, State)),
+ format_error({unable_to_read_varsfile, FileName, Reason})),
Acc
end
end, [], FileNames).