瀏覽代碼

Merge pull request #1850 from ferd/helpful-includelib-error

Friendlier output on include_lib errors
pull/1831/merge
Fred Hebert 6 年之前
committed by GitHub
父節點
當前提交
c96222ead3
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 13 次插入3 次删除
  1. +13
    -3
      src/rebar_base_compiler.erl

+ 13
- 3
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]);

Loading…
取消
儲存