diff options
author | Eric <[email protected]> | 2012-10-23 09:47:29 -0500 |
---|---|---|
committer | Jordan Wilberding <[email protected]> | 2012-10-24 11:30:00 -0600 |
commit | d418f238a12d5e89223400bdfed844c673c3f12f (patch) | |
tree | b12fe6b8ebce64deaf71688c91898189b1e3408e /src/relcool.erl | |
parent | 6fa2c6d6747e9e83f341cd1eaeee294ca836584b (diff) | |
download | relx-d418f238a12d5e89223400bdfed844c673c3f12f.tar.gz relx-d418f238a12d5e89223400bdfed844c673c3f12f.tar.bz2 relx-d418f238a12d5e89223400bdfed844c673c3f12f.zip |
fix miscalculation in error reporting in relcool.erl
Signed-off-by: Jordan Wilberding <[email protected]>
Diffstat (limited to 'src/relcool.erl')
-rw-r--r-- | src/relcool.erl | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/relcool.erl b/src/relcool.erl index 98b84f7..13ef2ea 100644 --- a/src/relcool.erl +++ b/src/relcool.erl @@ -43,12 +43,7 @@ main(Args) -> OptSpecList = opt_spec_list(), case rcl_cmd_args:args2state(getopt:parse(OptSpecList, Args)) of {ok, {State, _Target}} -> - case run_relcool_process(rcl_state:caller(State, command_line)) of - Result = {ok, _} -> - Result; - Error={error, _} -> - report_error(State, Error) - end; + run_relcool_process(rcl_state:caller(State, command_line)); Error={error, _} -> report_error(rcl_state:caller(rcl_state:new([], []), command_line), Error) @@ -88,10 +83,7 @@ opt_spec_list() -> -spec format_error(Reason::term()) -> iolist(). format_error({invalid_return_value, Provider, Value}) -> [rcl_provider:format(Provider), " returned an invalid value ", - io_lib:format("~p", [Value])]; -format_error({error, {Module, Reason}}) -> - io_lib:format("~s", [Module:format_error(Reason)]). - + io_lib:format("~p", [Value])]. %%============================================================================ %% internal api @@ -144,13 +136,14 @@ run_provider(Provider, {ok, State0}) -> {ok, State1} -> {ok, State1}; E={error, _} -> - E + report_error(State0, E) end. -spec usage() -> ok. usage() -> getopt:usage(opt_spec_list(), "relcool", "[*release-specification-file*]"). + -spec report_error(rcl_state:t(), error()) -> none() | error(). report_error(State, Error={error, {Module, Reason}}) -> io:format("~s~n", [Module:format_error(Reason)]), |