diff options
author | Umberto Corponi <umberto.corponi@athonet.com> | 2015-05-06 16:44:06 +0200 |
---|---|---|
committer | Umberto Corponi <umberto.corponi@athonet.com> | 2015-05-06 16:44:06 +0200 |
commit | 291e0de2fe6d637511f3739a1a29004870e09b2e (patch) | |
tree | 8bf6767168f00944582be62fbffb8bf5da0651db /src/rebar_prv_app_discovery.erl | |
parent | 5cf005d3a63608ff4a9a7151d8461f360c86cfbb (diff) |
Manage syntax error in app.src files.
- Solve "Uncaught error" failure in case of syntax error in app.src file.
- Print helpful information on the location of the syntax error.
Diffstat (limited to 'src/rebar_prv_app_discovery.erl')
-rw-r--r-- | src/rebar_prv_app_discovery.erl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/rebar_prv_app_discovery.erl b/src/rebar_prv_app_discovery.erl index 31c0f59..97862c1 100644 --- a/src/rebar_prv_app_discovery.erl +++ b/src/rebar_prv_app_discovery.erl @@ -45,5 +45,13 @@ do(State) -> -spec format_error(any()) -> iolist(). format_error({multiple_app_files, Files}) -> io_lib:format("Multiple app files found in one app dir: ~s", [string:join(Files, " and ")]); +format_error({invalid_app_file, File, Reason}) -> + case Reason of + {Line, erl_parse, Description} -> + io_lib:format("Invalid app file ~s at line ~b: ~p", + [File, Line, lists:flatten(Description)]); + _ -> + io_lib:format("Invalid app file ~s: ~p", [File, Reason]) + end; format_error(Reason) -> io_lib:format("~p", [Reason]). |