aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-04-26 15:27:47 +0200
committerLoïc Hoguin <[email protected]>2019-04-26 15:27:47 +0200
commitf422624ce4527ce5b07bad63c5fda50e13ff4994 (patch)
treea41f5bdb75422706d6b0cd9c517b97b54e9b2549 /src/gun.erl
parent3c15d2c749b95032944d89738a4cf118dfb3115d (diff)
downloadgun-f422624ce4527ce5b07bad63c5fda50e13ff4994.tar.gz
gun-f422624ce4527ce5b07bad63c5fda50e13ff4994.tar.bz2
gun-f422624ce4527ce5b07bad63c5fda50e13ff4994.zip
Distinguish between error types in await functions
Diffstat (limited to 'src/gun.erl')
-rw-r--r--src/gun.erl14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gun.erl b/src/gun.erl
index 43a6bf9..d5a39af 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -518,11 +518,11 @@ await(ServerPid, StreamRef, Timeout, MRef) ->
{gun_push, ServerPid, StreamRef, NewStreamRef, Method, URI, Headers} ->
{push, NewStreamRef, Method, URI, Headers};
{gun_error, ServerPid, StreamRef, Reason} ->
- {error, Reason};
+ {error, {stream_error, Reason}};
{gun_error, ServerPid, Reason} ->
- {error, Reason};
+ {error, {connection_error, Reason}};
{'DOWN', MRef, process, ServerPid, Reason} ->
- {error, Reason}
+ {error, {down, Reason}}
after Timeout ->
{error, timeout}
end.
@@ -556,11 +556,11 @@ await_body(ServerPid, StreamRef, Timeout, MRef, Acc) ->
{gun_trailers, ServerPid, StreamRef, Trailers} ->
{ok, Acc, Trailers};
{gun_error, ServerPid, StreamRef, Reason} ->
- {error, Reason};
+ {error, {stream_error, Reason}};
{gun_error, ServerPid, Reason} ->
- {error, Reason};
+ {error, {connection_error, Reason}};
{'DOWN', MRef, process, ServerPid, Reason} ->
- {error, Reason}
+ {error, {down, Reason}}
after Timeout ->
{error, timeout}
end.
@@ -587,7 +587,7 @@ await_up(ServerPid, Timeout, MRef) ->
{gun_up, ServerPid, Protocol} ->
{ok, Protocol};
{'DOWN', MRef, process, ServerPid, Reason} ->
- {error, Reason}
+ {error, {down, Reason}}
after Timeout ->
{error, timeout}
end.