diff options
author | Eric B Merritt <[email protected]> | 2013-02-05 16:49:59 -0800 |
---|---|---|
committer | Eric B Merritt <[email protected]> | 2013-02-05 17:10:53 -0800 |
commit | a90291da9eb49e36e17c13afc31517bb636e6426 (patch) | |
tree | e2624f5d4ed009fd2551ad2c5adebbbb18d036da | |
parent | 26851a2e1c59124dea325e9a38cda25da463839a (diff) | |
download | relx-a90291da9eb49e36e17c13afc31517bb636e6426.tar.gz relx-a90291da9eb49e36e17c13afc31517bb636e6426.tar.bz2 relx-a90291da9eb49e36e17c13afc31517bb636e6426.zip |
fix bug in error reporting by relcool
-rw-r--r-- | src/relcool.erl | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/relcool.erl b/src/relcool.erl index 83886c5..c8c0cde 100644 --- a/src/relcool.erl +++ b/src/relcool.erl @@ -44,12 +44,20 @@ -spec main([string()]) -> ok | error() | {ok, rcl_state:t()}. main(Args) -> OptSpecList = opt_spec_list(), - case rcl_cmd_args:args2state(getopt:parse(OptSpecList, Args)) of - {ok, State} -> - run_relcool_process(rcl_state:caller(State, command_line)); - Error={error, _} -> + Result = + case rcl_cmd_args:args2state(getopt:parse(OptSpecList, Args)) of + {ok, State} -> + run_relcool_process(rcl_state:caller(State, command_line)); + Error={error, _} -> + Error + end, + case Result of + {error, _} -> report_error(rcl_state:caller(rcl_state:new([], undefined), - command_line), Error) + command_line), + Result); + _ -> + Result end. %% @doc provides an API to run the Relcool process from erlang applications @@ -128,7 +136,7 @@ opt_spec_list() -> "Disable the default system added lib dirs (means you must add them all manually"}, {log_level, $V, "verbose", {integer, 1}, "Verbosity level, maybe between 0 and 2"}, - {config, $c, "config", string, "The path to a config file"}, + {config, $c, "config", {string, ""}, "The path to a config file"}, {root_dir, $r, "root", string, "The project root directory"}]. -spec format_error(Reason::term()) -> iolist(). @@ -194,9 +202,12 @@ run_provider(Provider, {ok, State0}) -> [rcl_provider:impl(Provider)]), case rcl_provider:do(Provider, State0) of {ok, State1} -> + rcl_log:debug(rcl_state:log(State0), "Provider successfully run: ~p~n", + [rcl_provider:impl(Provider)]), {ok, State1}; E={error, _} -> - + rcl_log:debug(rcl_state:log(State0), "Provider (~p) failed with: ~p~n", + [rcl_provider:impl(Provider), E]), E end. |