ソースを参照

move back to using format_error/1

pull/3/head
Tristan Sloughter 10年前
コミット
79b1f23240
23個のファイルの変更98行の追加94行の削除
  1. +3
    -3
      rebar.config
  2. +1
    -2
      src/rebar3.erl
  3. +4
    -4
      src/rebar_prv_app_discovery.erl
  4. +4
    -4
      src/rebar_prv_clean.erl
  5. +4
    -4
      src/rebar_prv_common_test.erl
  6. +6
    -5
      src/rebar_prv_compile.erl
  7. +4
    -4
      src/rebar_prv_deps.erl
  8. +6
    -6
      src/rebar_prv_dialyzer.erl
  9. +4
    -4
      src/rebar_prv_do.erl
  10. +4
    -4
      src/rebar_prv_erlydtl_compiler.erl
  11. +4
    -4
      src/rebar_prv_eunit.erl
  12. +4
    -4
      src/rebar_prv_help.erl
  13. +4
    -4
      src/rebar_prv_install_deps.erl
  14. +4
    -4
      src/rebar_prv_lock.erl
  15. +4
    -4
      src/rebar_prv_new.erl
  16. +4
    -4
      src/rebar_prv_packages.erl
  17. +10
    -6
      src/rebar_prv_release.erl
  18. +4
    -4
      src/rebar_prv_shell.erl
  19. +4
    -4
      src/rebar_prv_tar.erl
  20. +4
    -4
      src/rebar_prv_test_deps.erl
  21. +4
    -4
      src/rebar_prv_update.erl
  22. +4
    -4
      src/rebar_prv_upgrade.erl
  23. +4
    -4
      src/rebar_prv_version.erl

+ 3
- 3
rebar.config ファイルの表示

@ -31,10 +31,10 @@
{branch, "master"}}},
{providers, "",
{git, "https://github.com/tsloughter/providers.git",
{branch, "master"}}},
{branch, "format_error1"}}},
{relx, "",
{git, "https://github.com/erlware/relx.git",
{branch, "master"}}},
{git, "https://github.com/tsloughter/relx.git",
{branch, "format_error1"}}},
{getopt, "", {git, "https://github.com/jcomellas/getopt.git", {branch, "master"}}}]}.
{erlydtl_opts, [{doc_root, "priv/templates"},

+ 1
- 2
src/rebar3.erl ファイルの表示

@ -56,8 +56,7 @@ main(Args) ->
?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace", []),
?DEBUG("Uncaught error: ~p ~p", [Module, Reason]);
_ ->
{Error, _} = Module:format_error(Reason, []),
?ERROR(Error, [])
?ERROR(Module:format_error(Reason), [])
end,
rebar_utils:delayed_halt(1);
{error, Error} when is_list(Error) ->

+ 4
- 4
src/rebar_prv_app_discovery.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -36,6 +36,6 @@ do(State) ->
State1 = rebar_app_discover:do(State, LibDirs),
{ok, State1}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).

+ 4
- 4
src/rebar_prv_clean.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -55,9 +55,9 @@ do(State) ->
{ok, State}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions

+ 4
- 4
src/rebar_prv_common_test.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -38,9 +38,9 @@ do(State) ->
ct:run_test(Opts),
{ok, State}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
expand_test_deps(Dir) ->
Apps = filelib:wildcard(filename:join([Dir, "*", "ebin"])),

+ 6
- 5
src/rebar_prv_compile.erl ファイルの表示

@ -4,8 +4,9 @@
-export([init/1,
do/1,
format_error/2,
build/2]).
format_error/1]).
-export([build/2]).
-include("rebar.hrl").
@ -59,9 +60,9 @@ do(State) ->
{ok, State1}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
build_apps(State, Apps) ->
lists:foreach(fun(AppInfo) ->

+ 4
- 4
src/rebar_prv_deps.erl ファイルの表示

@ -4,7 +4,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -27,9 +27,9 @@ init(State) ->
do(State) ->
{ok, State}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
info(Description) ->
io_lib:format("~s.~n"

+ 6
- 6
src/rebar_prv_dialyzer.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -64,11 +64,11 @@ do(State) ->
{error, {?MODULE, {error_processing_apps, Error, Apps}}}
end.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error({error_processing_apps, Error, _Apps}, State) ->
{io_lib:format("Error in dialyzing apps: ~s", [Error]), State};
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error({error_processing_apps, Error, _Apps}) ->
io_lib:format("Error in dialyzing apps: ~s", [Error]);
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%% Internal functions

+ 4
- 4
src/rebar_prv_do.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -41,9 +41,9 @@ do(State) ->
rebar_core:process_command(StateAcc2, Task)
end, {ok, State}, Tasks).
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
args_to_tasks(Args) ->
[string:strip(T) || T <- string:tokens(string:join(Args, " "), ",")].

+ 4
- 4
src/rebar_prv_erlydtl_compiler.erl ファイルの表示

@ -98,7 +98,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
%% for internal use only
-export([info/2]).
@ -146,9 +146,9 @@ do(Config) ->
true = code:set_path(OrigPath),
{Result, Config}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions

+ 4
- 4
src/rebar_prv_eunit.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -50,9 +50,9 @@ do(State) ->
end,
{ok, State}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
run_eunit(Config, CodePath, SrcErls) ->
%% Build a list of all the .beams in ?EUNIT_DIR -- use this for

+ 4
- 4
src/rebar_prv_help.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -50,9 +50,9 @@ do(State) ->
end
end.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%%
%% print help/usage string

+ 4
- 4
src/rebar_prv_install_deps.erl ファイルの表示

@ -30,7 +30,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -90,9 +90,9 @@ do(State) ->
{error, Reason}
end.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
-spec get_deps_dir(rebar_state:t()) -> file:filename_all().
get_deps_dir(State) ->

+ 4
- 4
src/rebar_prv_lock.erl ファイルの表示

@ -4,7 +4,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -55,9 +55,9 @@ do(State) ->
{ok, State}
end.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
info(_) ->
"".

+ 4
- 4
src/rebar_prv_new.erl ファイルの表示

@ -4,7 +4,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -42,9 +42,9 @@ do(State) ->
{ok, State}
end.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions

+ 4
- 4
src/rebar_prv_packages.erl ファイルの表示

@ -4,7 +4,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -29,9 +29,9 @@ do(State) ->
print_packages(Packages),
{ok, State}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
print_packages(Packages) ->
Keys = lists:keysort(1, dict:fetch_keys(Packages)),

+ 10
- 6
src/rebar_prv_release.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -34,13 +34,17 @@ init(State) ->
do(State) ->
Options = rebar_state:command_args(State),
DepsDir = rebar_prv_install_deps:get_deps_dir(State),
OutputDir = filename:join(rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR), "releases"),
AllOptions = string:join(["release" | Options], " "),
try
case rebar_state:get(State, relx, []) of
[] ->
relx:main([{lib_dirs, [DepsDir]}], AllOptions);
relx:main([{lib_dirs, [DepsDir]}
,{output_dir, OutputDir}], AllOptions);
Config ->
relx:main([{lib_dirs, [DepsDir]}, {config, Config}], AllOptions)
relx:main([{lib_dirs, [DepsDir]}
,{config, Config}
,{output_dir, OutputDir}], AllOptions)
end,
{ok, State}
catch
@ -48,6 +52,6 @@ do(State) ->
{error, {rlx_prv_release, T}}
end.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).

+ 4
- 4
src/rebar_prv_shell.erl ファイルの表示

@ -32,7 +32,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -60,9 +60,9 @@ do(Config) ->
shell(),
{ok, Config}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%% NOTE:
%% this is an attempt to replicate `erl -pa ./ebin -pa deps/*/ebin`. it is

+ 4
- 4
src/rebar_prv_tar.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -43,6 +43,6 @@ do(State) ->
end,
{ok, State}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).

+ 4
- 4
src/rebar_prv_test_deps.erl ファイルの表示

@ -4,7 +4,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -52,9 +52,9 @@ do(State) ->
{error, Error}
end.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions

+ 4
- 4
src/rebar_prv_update.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -47,9 +47,9 @@ do(State) ->
{ok, State}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(package_index_write, State) ->
{"Failed to write package index.", State}.
-spec format_error(any()) -> iolist().
format_error(package_index_write) ->
"Failed to write package index.".
url(State) ->
SystemArch = erlang:system_info(system_architecture),

+ 4
- 4
src/rebar_prv_upgrade.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -49,6 +49,6 @@ do(State) ->
{error, io_lib:format("No such dependency ~s~n", [Name])}
end.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).

+ 4
- 4
src/rebar_prv_version.erl ファイルの表示

@ -7,7 +7,7 @@
-export([init/1,
do/1,
format_error/2]).
format_error/1]).
-include("rebar.hrl").
@ -36,6 +36,6 @@ do(State) ->
rebar3:version(),
{ok, State}.
-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
format_error(Reason, State) ->
{io_lib:format("~p", [Reason]), State}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).

読み込み中…
キャンセル
保存