aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rebar.config2
-rw-r--r--src/rlx_prv_archive.erl8
-rw-r--r--src/rlx_prv_assembler.erl22
-rw-r--r--src/rlx_prv_discover.erl6
-rw-r--r--src/rlx_prv_overlay.erl32
-rw-r--r--src/rlx_prv_release.erl20
-rw-r--r--src/rlx_prv_relup.erl14
7 files changed, 52 insertions, 52 deletions
diff --git a/rebar.config b/rebar.config
index ca9894b..9c1de86 100644
--- a/rebar.config
+++ b/rebar.config
@@ -10,7 +10,7 @@
{branch, "master"}}},
{providers, ".*",
{git, "https://github.com/tsloughter/providers.git",
- {branch, "master"}}},
+ {branch, "format_error"}}},
{erlydtl, ".*",
{git, "https://github.com/erlydtl/erlydtl.git",
{tag, "0.9.0"}}},
diff --git a/src/rlx_prv_archive.erl b/src/rlx_prv_archive.erl
index 8370659..261a63e 100644
--- a/src/rlx_prv_archive.erl
+++ b/src/rlx_prv_archive.erl
@@ -26,7 +26,7 @@
-export([init/1,
do/1,
- format_error/1]).
+ format_error/2]).
-include("relx.hrl").
@@ -57,13 +57,13 @@ do(State) ->
OutputDir = rlx_state:output_dir(State),
make_tar(State, Release, OutputDir).
-format_error({tar_unknown_generation_error, Module, Vsn}) ->
+format_error({tar_unknown_generation_error, Module, Vsn}, _) ->
io_lib:format("Tarball generation error of ~s ~s",
[Module, Vsn]);
-format_error({tar_generation_warn, Module, Warnings}) ->
+format_error({tar_generation_warn, Module, Warnings}, _) ->
io_lib:format("Tarball generation warnings for ~p : ~p",
[Module, Warnings]);
-format_error({tar_generation_error, Module, Errors}) ->
+format_error({tar_generation_error, Module, Errors}, _) ->
io_lib:format("Tarball generation error for ~p reason ~p",
[Module, Errors]).
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index 8a25cdd..7ef655b 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -26,7 +26,7 @@
-export([init/1,
do/1,
- format_error/1]).
+ format_error/2]).
-include("relx.hrl").
@@ -68,31 +68,31 @@ do(State) ->
Error
end.
--spec format_error(ErrorDetail::term()) -> iolist().
-format_error({unresolved_release, RelName, RelVsn}) ->
+-spec format_error(ErrorDetail::term(), rlx_state:t()) -> 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({config_does_not_exist, Path}) ->
+format_error({config_does_not_exist, Path}, _) ->
io_lib:format("The config file specified for this release (~s) does not exist!",
[Path]);
-format_error({specified_erts_does_not_exist, ErtsVersion}) ->
+format_error({specified_erts_does_not_exist, ErtsVersion}, _) ->
io_lib:format("Specified version of erts (~s) does not exist",
[ErtsVersion]);
-format_error({release_script_generation_error, RelFile}) ->
+format_error({release_script_generation_error, RelFile}, _) ->
io_lib:format("Unknown internal release error generating the release file to ~s",
[RelFile]);
-format_error({release_script_generation_warning, Module, Warnings}) ->
+format_error({release_script_generation_warning, Module, Warnings}, _) ->
["Warnings generating release \s",
rlx_util:indent(2), Module:format_warning(Warnings)];
-format_error({unable_to_create_output_dir, OutputDir}) ->
+format_error({unable_to_create_output_dir, OutputDir}, _) ->
io_lib:format("Unable to create output directory (possible permissions issue): ~s",
[OutputDir]);
-format_error({release_script_generation_error, Module, Errors}) ->
+format_error({release_script_generation_error, Module, Errors}, _) ->
["Errors generating release \n",
rlx_util:indent(2), Module:format_error(Errors)];
-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)]).
diff --git a/src/rlx_prv_discover.erl b/src/rlx_prv_discover.erl
index 520cf15..41e3993 100644
--- a/src/rlx_prv_discover.erl
+++ b/src/rlx_prv_discover.erl
@@ -27,7 +27,7 @@
-export([init/1,
do/1,
- format_error/1]).
+ format_error/2]).
-include("relx.hrl").
@@ -72,8 +72,8 @@ do(State0) ->
%% @doc this is here to comply with the signature. However, we do not actually
%% produce any errors and so simply return an empty string.
--spec format_error(any()) -> iolist().
-format_error(_) ->
+-spec format_error(any(), rlx_state:t()) -> iolist().
+format_error(_, _) ->
"".
%%%===================================================================
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index f7e2be8..cfdaf77 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -26,7 +26,7 @@
-export([init/1,
do/1,
- format_error/1]).
+ format_error/2]).
-define(DIRECTORY_RE, ".*(\/|\\\\)$").
@@ -66,40 +66,40 @@ do(State) ->
?RLX_ERROR({unresolved_release, RelName, RelVsn})
end.
--spec format_error(ErrorDetail::term()) -> iolist().
-format_error({unresolved_release, RelName, RelVsn}) ->
+-spec format_error(ErrorDetail::term(), rlx_state:t()) -> 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}) ->
- [[format_error(rlx_util:error_reason(Error)), "\n"] || Error <- Errors];
-format_error({dir_render_failed, Dir, Error}) ->
+format_error({overlay_failed, Errors}, State) ->
+ [[format_error(rlx_util:error_reason(Error), State), "\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}) ->
+format_error({unable_to_compile_template, FromFile, Reason}, _) ->
io_lib:format("Unable to compile template ~s because \n~s",
[FromFile, [format_errors(F, Es) || {F, Es} <- Reason]]);
-format_error({unable_to_make_dir, Absolute, Error}) ->
+format_error({unable_to_make_dir, Absolute, Error}, _) ->
io_lib:format("Unable to make directory ~s because ~p",
[Absolute, Error]).
@@ -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})),
+ format_error({unable_to_read_varsfile, FileName, Reason}, State)),
Acc
end
end, [], FileNames).
diff --git a/src/rlx_prv_release.erl b/src/rlx_prv_release.erl
index d579291..d51fc07 100644
--- a/src/rlx_prv_release.erl
+++ b/src/rlx_prv_release.erl
@@ -28,7 +28,7 @@
-export([init/1,
do/1,
- format_error/1]).
+ format_error/2]).
-include("relx.hrl").
@@ -58,24 +58,24 @@ do(State) ->
DepGraph = create_dep_graph(State),
find_default_release(State, DepGraph).
--spec format_error(ErrorDetail::term()) -> iolist().
-format_error(no_goals_specified) ->
+-spec format_error(ErrorDetail::term(), rlx_state:t()) -> iolist().
+format_error(no_goals_specified, _) ->
"No goals specified for this release ~n";
-format_error({no_release_name, Vsn}) ->
+format_error({no_release_name, Vsn}, _) ->
io_lib:format("A target release version was specified (~s) but no name", [Vsn]);
-format_error({invalid_release_info, Info}) ->
+format_error({invalid_release_info, Info}, _) ->
io_lib:format("Target release information is in an invalid format ~p", [Info]);
-format_error({multiple_release_names, RelA, RelB}) ->
+format_error({multiple_release_names, RelA, RelB}, _) ->
io_lib:format("No default release name was specified and there are multiple "
"releases in the config: ~s, ~s",
[RelA, RelB]);
-format_error(no_releases_in_system) ->
+format_error(no_releases_in_system, _) ->
"No releases have been specified in the system!";
-format_error({no_releases_for, RelName}) ->
+format_error({no_releases_for, RelName}, _) ->
io_lib:format("No releases exist in the system for ~s!", [RelName]);
-format_error({release_not_found, {RelName, RelVsn}}) ->
+format_error({release_not_found, {RelName, RelVsn}}, _) ->
io_lib:format("No releases exist in the system for ~p:~s!", [RelName, RelVsn]);
-format_error({failed_solve, Error}) ->
+format_error({failed_solve, Error}, _) ->
io_lib:format("Failed to solve release:\n ~s",
[rlx_depsolver:format_error({error, Error})]).
%%%===================================================================
diff --git a/src/rlx_prv_relup.erl b/src/rlx_prv_relup.erl
index bc86304..3564dd0 100644
--- a/src/rlx_prv_relup.erl
+++ b/src/rlx_prv_relup.erl
@@ -26,7 +26,7 @@
-export([init/1,
do/1,
- format_error/1]).
+ format_error/2]).
-include("relx.hrl").
@@ -55,22 +55,22 @@ do(State) ->
Release0 = rlx_state:get_realized_release(State, RelName, RelVsn),
make_relup(State, Release0).
-format_error({relup_generation_error, CurrentName, UpFromName}) ->
+format_error({relup_generation_error, CurrentName, UpFromName}, _) ->
io_lib:format("Unknown internal release error generating the relup from ~s to ~s",
[UpFromName, CurrentName]);
-format_error({relup_generation_warning, Module, Warnings}) ->
+format_error({relup_generation_warning, Module, Warnings}, _) ->
["Warnings generating relup \s",
rlx_util:indent(2), Module:format_warning(Warnings)];
-format_error({no_upfrom_release_found, undefined}) ->
+format_error({no_upfrom_release_found, undefined}, _) ->
io_lib:format("No earlier release for relup found", []);
-format_error({no_upfrom_release_found, Vsn}) ->
+format_error({no_upfrom_release_found, Vsn}, _) ->
io_lib:format("Upfrom release version (~s) for relup not found", [Vsn]);
format_error({relup_script_generation_error,
{relup_script_generation_error, systools_relup,
- {missing_sasl, _}}}) ->
+ {missing_sasl, _}}}, _) ->
"Unfortunately, due to requirements in systools, you need to have the sasl application "
"in both the current release and the release to upgrade from.";
-format_error({relup_script_generation_error, Module, Errors}) ->
+format_error({relup_script_generation_error, Module, Errors}, _) ->
["Errors generating relup \n",
rlx_util:indent(2), Module:format_error(Errors)].