diff options
author | Jordan Wilberding <[email protected]> | 2014-11-10 09:21:59 -0800 |
---|---|---|
committer | Jordan Wilberding <[email protected]> | 2014-11-10 09:21:59 -0800 |
commit | 3f93086c57664015b921221647c0f2b56519fd7c (patch) | |
tree | 2bb652df3be9f3e2b4187bf073672dad4f7dda10 /src/relx.erl | |
parent | 64b946e351a92bd2686d0a4370c252a53eaa82bd (diff) | |
parent | bf953e417d0771583d95d4d6b6e2697ab44754d6 (diff) | |
download | relx-3f93086c57664015b921221647c0f2b56519fd7c.tar.gz relx-3f93086c57664015b921221647c0f2b56519fd7c.tar.bz2 relx-3f93086c57664015b921221647c0f2b56519fd7c.zip |
Merge pull request #263 from tsloughter/format_error1
move back to using format_error/1
Diffstat (limited to 'src/relx.erl')
-rw-r--r-- | src/relx.erl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/relx.erl b/src/relx.erl index ddfcf94..eb3b969 100644 --- a/src/relx.erl +++ b/src/relx.erl @@ -26,7 +26,7 @@ do/7, do/8, do/9, - format_error/2, + format_error/1, 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(), rlx_state:t()) -> string(). -format_error({invalid_return_value, Provider, Value}, _) -> +-spec format_error(Reason::term()) -> 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}}, _) -> +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}}, State) -> - format_error(Reason, State); -format_error({error, {Module, Reason}}, State) -> - io_lib:format("~s~n", [Module:format_error(Reason, State)]). +format_error({error, {relx, Reason}}) -> + format_error(Reason); +format_error({error, {Module, Reason}}) -> + io_lib:format("~s~n", [Module:format_error(Reason)]). %%============================================================================ %% internal api @@ -305,13 +305,13 @@ usage() -> report_error(State, Error) -> case Error of {error, {relx, {opt_parse, _}}} -> - io:format(standard_error, format_error(Error, State), []), + io:format(standard_error, format_error(Error), []), usage(); {error, {rlx_cmd_args, _}} -> - io:format(standard_error, format_error(Error, State), []), + io:format(standard_error, format_error(Error), []), usage(); _ -> - io:format(standard_error, format_error(Error, State), []) + io:format(standard_error, format_error(Error), []) end, case rlx_state:caller(State) of command_line -> |