aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Kallas <konstantinos.kallas@hotmail.com>2017-08-12 17:26:07 +0300
committerKonstantinos Kallas <konstantinos.kallas@hotmail.com>2017-08-12 17:26:07 +0300
commit3b22efeaeea139015bc631b04029b2af4bdf5295 (patch)
tree600d0ca67998b1754645ba6ce395bbdca9b58baa /src
parentAdd support to revoke a certificate by providing the pem (diff)
Add throws when http requests fail
This was done in order to show the unexpected code in the top level
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_acme_comm.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ejabberd_acme_comm.erl b/src/ejabberd_acme_comm.erl
index b66d5f610..99eaff87b 100644
--- a/src/ejabberd_acme_comm.erl
+++ b/src/ejabberd_acme_comm.erl
@@ -291,7 +291,7 @@ prepare_get_request(Url, HandleRespFun, ResponseType) ->
-spec sign_json_jose(jose_jwk:key(), bitstring(), nonce()) -> {_, jws()}.
sign_json_jose(Key, Json, Nonce) ->
- PubKey = jose_jwk:to_public(Key),
+ PubKey = ejabberd_acme:to_public(Key),
{_, BinaryPubKey} = jose_jwk:to_binary(PubKey),
PubKeyJson = jiffy:decode(BinaryPubKey),
%% TODO: Ensure this works for all cases
@@ -383,11 +383,11 @@ decode(Json) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-spec failed_http_request({ok, _} | {error, _}, url()) -> {error, _}.
-failed_http_request({ok, {{_, Code, _}, _Head, Body}}, Url) ->
+failed_http_request({ok, {{_, Code, Reason}, _Head, Body}}, Url) ->
?ERROR_MSG("Got unexpected status code from <~s>: ~B, Body: ~s",
[Url, Code, Body]),
- {error, unexpected_code};
+ throw({error, {unexpected_code, Code, Reason}});
failed_http_request({error, Reason}, Url) ->
?ERROR_MSG("Error making a request to <~s>: ~p",
[Url, Reason]),
- {error, Reason}.
+ throw({error, Reason}).