diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-03-16 01:44:24 +0000 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-03-16 15:58:44 +0000 |
commit | 92245a138b7ee314e625486b9f537ac267a35aa6 (patch) | |
tree | 2d9913a65be9f0de9c5494a8080e4e6b6c994c2b | |
parent | 6e337e022c3c4521ee84121845305b494127aaf2 (diff) |
use PRV_ERROR for formattable errors
Also expose it in rebar_api
-rw-r--r-- | src/rebar_api.erl | 1 | ||||
-rw-r--r-- | src/rebar_prv_app_discovery.erl | 3 | ||||
-rw-r--r-- | src/rebar_prv_common_test.erl | 3 | ||||
-rw-r--r-- | src/rebar_prv_dialyzer.erl | 5 | ||||
-rw-r--r-- | src/rebar_prv_eunit.erl | 3 | ||||
-rw-r--r-- | src/rebar_prv_update.erl | 3 | ||||
-rw-r--r-- | src/rebar_prv_upgrade.erl | 7 | ||||
-rw-r--r-- | src/rebar_prv_xref.erl | 3 |
8 files changed, 18 insertions, 10 deletions
diff --git a/src/rebar_api.erl b/src/rebar_api.erl index c217b85..a01391d 100644 --- a/src/rebar_api.erl +++ b/src/rebar_api.erl @@ -2,6 +2,7 @@ %%% that can be used by plugin builders. -module(rebar_api). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -export([abort/0, abort/2, console/2, debug/2, info/2, warn/2, error/2]). diff --git a/src/rebar_prv_app_discovery.erl b/src/rebar_prv_app_discovery.erl index 5e304cb..31c0f59 100644 --- a/src/rebar_prv_app_discovery.erl +++ b/src/rebar_prv_app_discovery.erl @@ -10,6 +10,7 @@ format_error/1]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -define(PROVIDER, app_discovery). -define(DEPS, []). @@ -38,7 +39,7 @@ do(State) -> {ok, State1} catch throw:{error, Error}-> - {error, {?MODULE, Error}} + ?PRV_ERROR(Error) end. -spec format_error(any()) -> iolist(). diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index c49f4c5..f4085c5 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -10,6 +10,7 @@ format_error/1]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -define(PROVIDER, ct). -define(DEPS, [compile]). @@ -46,7 +47,7 @@ do(State) -> {ok, CTOpts} -> run_test(State, RawOpts, CTOpts); {error, Reason} -> - {error, {?MODULE, Reason}} + ?PRV_ERROR(Reason) end. run_test(State, RawOpts, CTOpts) -> diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl index 24e276d..ef6a64c 100644 --- a/src/rebar_prv_dialyzer.erl +++ b/src/rebar_prv_dialyzer.erl @@ -10,6 +10,7 @@ format_error/1]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -define(PROVIDER, dialyzer). -define(DEPS, [compile]). @@ -70,9 +71,9 @@ do(State) -> do(State, Plt, Apps) catch throw:{dialyzer_error, Error} -> - {error, {?MODULE, {error_processing_apps, Error}}}; + ?PRV_ERROR({error_processing_apps, Error}); throw:{dialyzer_warnings, Warnings} -> - {error, {?MODULE, {dialyzer_warnings, Warnings}}} + ?PRV_ERROR({dialyzer_warnings, Warnings}) end. -spec format_error(any()) -> iolist(). diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index 8763344..0e0e937 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -10,6 +10,7 @@ format_error/1]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -define(PROVIDER, eunit). -define(DEPS, [compile]). @@ -46,7 +47,7 @@ do(State) -> ok = rebar_prv_cover:maybe_write_coverdata(State, ?PROVIDER), case handle_results(Result) of {error, Reason} -> - {error, {?MODULE, Reason}}; + ?PRV_ERROR(Reason); ok -> {ok, State} end. diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl index d0bdd1b..e851f7b 100644 --- a/src/rebar_prv_update.erl +++ b/src/rebar_prv_update.erl @@ -10,6 +10,7 @@ format_error/1]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -define(PROVIDER, update). -define(DEPS, []). @@ -48,7 +49,7 @@ do(State) -> ok catch _E:_C -> - throw({error, {?MODULE, package_index_write}}) + ?PRV_ERROR(package_index_write) end, {ok, State}. diff --git a/src/rebar_prv_upgrade.erl b/src/rebar_prv_upgrade.erl index 1cae5aa..37914a7 100644 --- a/src/rebar_prv_upgrade.erl +++ b/src/rebar_prv_upgrade.erl @@ -10,6 +10,7 @@ format_error/1]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -define(PROVIDER, upgrade). -define(DEPS, []). @@ -95,7 +96,7 @@ prepare_locks([Name|Names], Deps, Locks, Unlocks) -> AtomName = binary_to_atom(Name, utf8), case lists:keyfind(AtomName, 1, Deps) of false -> - {error, {?MODULE, {unknown_dependency, Name}}}; + ?PRV_ERROR({unknown_dependency, Name}); Dep -> Source = case Dep of {_, Src} -> Src; @@ -108,9 +109,9 @@ prepare_locks([Name|Names], Deps, Locks, Unlocks) -> [{Name, Source, 0} | NewUnlocks ++ Unlocks]) end; {_, _, Level} when Level > 0 -> - {error, {?MODULE, {transitive_dependency,Name}}}; + ?PRV_ERROR({transitive_dependency, Name}); false -> - {error, {?MODULE, {unknown_dependency,Name}}} + ?PRV_ERROR({unknown_dependency, Name}) end. top_level_deps(Deps, Locks) -> diff --git a/src/rebar_prv_xref.erl b/src/rebar_prv_xref.erl index 142f8fd..cc33f51 100644 --- a/src/rebar_prv_xref.erl +++ b/src/rebar_prv_xref.erl @@ -10,6 +10,7 @@ format_error/1]). -include("rebar.hrl"). +-include_lib("providers/include/providers.hrl"). -define(PROVIDER, xref). -define(DEPS, [compile]). @@ -51,7 +52,7 @@ do(State) -> true -> {ok, State}; false -> - {error, {?MODULE, {xref_issues, XrefResults, QueryResults}}} + ?PRV_ERROR({xref_issues, XrefResults, QueryResults}) end. -spec format_error(any()) -> iolist(). |