diff options
author | Loïc Hoguin <[email protected]> | 2019-04-26 15:27:47 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-04-26 15:27:47 +0200 |
commit | f422624ce4527ce5b07bad63c5fda50e13ff4994 (patch) | |
tree | a41f5bdb75422706d6b0cd9c517b97b54e9b2549 /src | |
parent | 3c15d2c749b95032944d89738a4cf118dfb3115d (diff) | |
download | gun-f422624ce4527ce5b07bad63c5fda50e13ff4994.tar.gz gun-f422624ce4527ce5b07bad63c5fda50e13ff4994.tar.bz2 gun-f422624ce4527ce5b07bad63c5fda50e13ff4994.zip |
Distinguish between error types in await functions
Diffstat (limited to 'src')
-rw-r--r-- | src/gun.erl | 14 |
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. |