aboutsummaryrefslogtreecommitdiffstats
path: root/src/relx.erl
diff options
context:
space:
mode:
authorJordan Wilberding <[email protected]>2014-11-03 13:02:18 -0800
committerJordan Wilberding <[email protected]>2014-11-03 13:02:18 -0800
commit9d550533bb1440e93f4a014cb6303f427a51f2dc (patch)
tree346016bc34896d7919806ee2e3fa05564c4283a1 /src/relx.erl
parent5368a5cd945aa3dd0723258cdad051aa8f7b4920 (diff)
parent04ea67a7eded3cc296e27ce1a9ae766a638035df (diff)
downloadrelx-9d550533bb1440e93f4a014cb6303f427a51f2dc.tar.gz
relx-9d550533bb1440e93f4a014cb6303f427a51f2dc.tar.bz2
relx-9d550533bb1440e93f4a014cb6303f427a51f2dc.zip
Merge pull request #236 from tsloughter/format_error2
Some changes for providers as I work on rebar3
Diffstat (limited to 'src/relx.erl')
-rw-r--r--src/relx.erl26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/relx.erl b/src/relx.erl
index 433e0a5..25f3220 100644
--- a/src/relx.erl
+++ b/src/relx.erl
@@ -26,7 +26,7 @@
do/7,
do/8,
do/9,
- format_error/1,
+ format_error/2,
opt_spec_list/0]).
-export_type([error/0]).
@@ -216,18 +216,18 @@ opt_spec_list() ->
{version, undefined, "version", undefined, "Print relx version"},
{root_dir, $r, "root", string, "The project root directory"}].
--spec format_error(Reason::term()) -> string().
-format_error({invalid_return_value, Provider, Value}) ->
+-spec format_error(Reason::term(), rlx_state:t()) -> string().
+format_error({invalid_return_value, Provider, Value}, _) ->
io_lib:format(lists:flatten([providers:format(Provider), " returned an invalid value ",
- io_lib:format("~p", [Value])]), []);
-format_error({opt_parse, {invalid_option, Opt}}) ->
+ io_lib:format("~p", [Value])]), []);
+format_error({opt_parse, {invalid_option, Opt}}, _) ->
io_lib:format("invalid option ~s~n", [Opt]);
-format_error({opt_parse, Arg}) ->
+format_error({opt_parse, Arg}, _) ->
io_lib:format("~p~n", [Arg]);
-format_error({error, {relx, Reason}}) ->
- format_error(Reason);
-format_error({error, {Module, Reason}}) ->
- io_lib:format("~s~n", [Module:format_error(Reason)]).
+format_error({error, {relx, Reason}}, State) ->
+ format_error(Reason, State);
+format_error({error, {Module, Reason}}, State) ->
+ io_lib:format("~s~n", [Module:format_error(Reason, State)]).
%%============================================================================
%% internal api
@@ -304,13 +304,13 @@ usage() ->
report_error(State, Error) ->
case Error of
{error, {relx, {opt_parse, _}}} ->
- io:format(standard_error, format_error(Error), []),
+ io:format(standard_error, format_error(Error, State), []),
usage();
{error, {rlx_cmd_args, _}} ->
- io:format(standard_error, format_error(Error), []),
+ io:format(standard_error, format_error(Error, State), []),
usage();
_ ->
- io:format(standard_error, format_error(Error), [])
+ io:format(standard_error, format_error(Error, State), [])
end,
case rlx_state:caller(State) of
command_line ->