summaryrefslogtreecommitdiff
path: root/src/rebar_pkg_resource.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-05-12 19:32:24 -0500
committerTristan Sloughter <t@crashfast.com>2015-05-12 19:55:06 -0500
commit1643f4a1fc8a480c20ce972d9df47669111fff22 (patch)
tree1d6cab85bdb2af503e23f646bbfbf8a6aa209038 /src/rebar_pkg_resource.erl
parent1fe93136c426a0c742134f392cc7f4d4d7ef7b3b (diff)
wrap fetch errors in rebar_fetch PRV_ERROR
Diffstat (limited to 'src/rebar_pkg_resource.erl')
-rw-r--r--src/rebar_pkg_resource.erl11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
index 56e08fc..8bbd963 100644
--- a/src/rebar_pkg_resource.erl
+++ b/src/rebar_pkg_resource.erl
@@ -9,7 +9,6 @@
,needs_update/2
,make_vsn/1]).
--include_lib("providers/include/providers.hrl").
-include("rebar.hrl").
-define(DEFAULT_CDN, "https://s3.amazonaws.com/s3.hex.pm/tarballs").
@@ -44,7 +43,7 @@ cached_download(TmpDir, CachePath, Pkg, Url, ETag, State) ->
?DEBUG("Download ~s error, using ~s from cache", [Url, CachePath]),
serve_from_cache(TmpDir, CachePath, Pkg, State);
error ->
- throw(request_failed)
+ request_failed
end.
serve_from_cache(TmpDir, CachePath, Pkg, State) ->
@@ -54,11 +53,11 @@ serve_from_cache(TmpDir, CachePath, Pkg, State) ->
ok = erl_tar:extract({binary, Contents}, [{cwd, TmpDir}, compressed]),
{ok, true};
{_Bin, Chk, Chk} ->
- ?PRV_ERROR({failed_extract, CachePath});
+ {failed_extract, CachePath};
{Chk, _Reg, Chk} ->
- ?PRV_ERROR({bad_registry_checksum, CachePath});
+ {bad_registry_checksum, CachePath};
{_Bin, _Reg, _Tar} ->
- ?PRV_ERROR({bad_checksum, CachePath})
+ {bad_checksum, CachePath}
end.
serve_from_download(TmpDir, CachePath, Package, ETag, Binary, State) ->
@@ -69,7 +68,7 @@ serve_from_download(TmpDir, CachePath, Package, ETag, Binary, State) ->
serve_from_cache(TmpDir, CachePath, Package, State);
FileETag ->
?DEBUG("Download ETag ~s doesn't match cached ETag ~s", [ETag, FileETag]),
- ?PRV_ERROR({bad_download, CachePath})
+ {bad_download, CachePath}
end.