diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2018-08-03 20:56:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-03 20:56:22 -0400 |
commit | c96222ead3790d06448b447ef704546618e98d41 (patch) | |
tree | cea094be825e6db9d9e0e59cefa6ea2146fa6eaa /src | |
parent | 56531c9ee48797654ab228aa48b3c69b16dc19ac (diff) | |
parent | e157b6c23fcf86e76a87edf38283d5684df1307f (diff) |
Merge pull request #1850 from ferd/helpful-includelib-error
Friendlier output on include_lib errors
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_base_compiler.erl | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl index 3f273f1..00b0533 100644 --- a/src/rebar_base_compiler.erl +++ b/src/rebar_base_compiler.erl @@ -264,14 +264,24 @@ report(Messages) -> -spec format_errors(_, Extra, [err_or_warn()]) -> [string()] when Extra :: string(). format_errors(_MainSource, Extra, Errors) -> - [begin - [format_error(Source, Extra, Desc) || Desc <- Descs] - end + [[format_error(Source, Extra, Desc) || Desc <- Descs] || {Source, Descs} <- Errors]. %% @private format compiler errors into proper outputtable strings -spec format_error(file:filename(), Extra, err_or_warn()) -> string() when Extra :: string(). +format_error(Source, Extra, {Line, Mod=epp, Desc={include,lib,File}}) -> + %% Special case for include file errors, overtaking the default one + BaseDesc = Mod:format_error(Desc), + Friendly = case filename:split(File) of + [Lib, "include", _] -> + io_lib:format("; Make sure ~s is in your app " + "file's 'applications' list", [Lib]); + _ -> + "" + end, + FriendlyDesc = BaseDesc ++ Friendly, + ?FMT("~ts:~w: ~ts~ts~n", [Source, Line, Extra, FriendlyDesc]); format_error(Source, Extra, {{Line, Column}, Mod, Desc}) -> ErrorDesc = Mod:format_error(Desc), ?FMT("~ts:~w:~w: ~ts~ts~n", [Source, Line, Column, Extra, ErrorDesc]); |