mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Made more readable printout of the erlydtl compiler message
The printed message is made more terse. Example before applying patch: ERROR: Compiling template src/view/test.dtl failed: {error,{"src/view/test.dtl", [{{4,7}, erlydtl_parser, ["syntax error before: ",["\"\\\"HELLO_WORLD\\\"\""]]}]}} Example after applying patch: ERROR: Compiling template "src/cmp_html_error_template.dtl" failed: (line:3, col:12): ["syntax error before: ",["trans"]]
This commit is contained in:
parent
38902e9a52
commit
b606e3bfc5
1 changed files with 6 additions and 0 deletions
|
@ -190,12 +190,18 @@ do_compile(Source, Target, DtlOpts) ->
|
||||||
module_name(Target),
|
module_name(Target),
|
||||||
Opts) of
|
Opts) of
|
||||||
ok -> ok;
|
ok -> ok;
|
||||||
|
{error, {File, [{Pos, _Mod, Err}]}} ->
|
||||||
|
?ERROR("Compiling template ~p failed:~n (~s): ~p~n",
|
||||||
|
[File, err_location(Pos), Err]);
|
||||||
Reason ->
|
Reason ->
|
||||||
?ERROR("Compiling template ~s failed:~n ~p~n",
|
?ERROR("Compiling template ~s failed:~n ~p~n",
|
||||||
[Source, Reason]),
|
[Source, Reason]),
|
||||||
?FAIL
|
?FAIL
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
err_location({L,C}) -> io_lib:format("line:~w, col:~w", [L, C]);
|
||||||
|
err_location(L) -> io_lib:format("line:~w", [L]).
|
||||||
|
|
||||||
module_name(Target) ->
|
module_name(Target) ->
|
||||||
F = filename:basename(Target),
|
F = filename:basename(Target),
|
||||||
string:substr(F, 1, length(F)-length(".beam")).
|
string:substr(F, 1, length(F)-length(".beam")).
|
||||||
|
|
Loading…
Reference in a new issue