summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-02-27 20:25:19 -0600
committerTristan Sloughter <t@crashfast.com>2015-02-28 09:56:19 -0600
commita238bc24c678320c323dc57ca675ad19ad602d0e (patch)
treeb9f53d72b28af6f4852e04b7c59cae8d684976d9
parentae9c83fb4bafd3f2faf849c931ba440053f5cb97 (diff)
output proper error message for missing app file
-rw-r--r--src/rebar_otp_app.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl
index f55ac6e..278d7e5 100644
--- a/src/rebar_otp_app.erl
+++ b/src/rebar_otp_app.erl
@@ -51,6 +51,8 @@ compile(State, App) ->
%% Load the app file and validate it.
validate_app(State, App1).
+format_error(invalid_app_file) ->
+ "Failed to read app file";
format_error({file_read, File, Reason}) ->
io_lib:format("Failed to read ~s for processing: ~p", [File, Reason]);
format_error({invalid_name, File, AppName}) ->
@@ -174,11 +176,16 @@ ensure_registered(AppData) ->
%% config. However, in the case of *.app, rebar should not manipulate
%% that file. This enforces that dichotomy between app and app.src.
consult_app_file(Filename) ->
- case lists:suffix(".app.src", Filename) of
+ case filelib:is_file(Filename) of
false ->
- file:consult(Filename);
+ throw(?PRV_ERROR(invalid_app_file));
true ->
- {ok, rebar_config:consult_file(Filename)}
+ case lists:suffix(".app.src", Filename) of
+ false ->
+ file:consult(Filename);
+ true ->
+ {ok, rebar_config:consult_file(Filename)}
+ end
end.
app_vsn(AppFile) ->