1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
= gun_error(3)
== Name
gun_error - Stream or connection-wide error
== Description
[source,erlang]
----
{gun_error, ConnPid, StreamRef, Reason}
{gun_error, ConnPid, Reason}
ConnPid :: pid()
StreamRef :: reference()
Reason :: any()
----
Stream or connection-wide error.
These messages inform the relevant process that an error
occurred. A reference is given when the error pertains
to a specific stream. Connection-wide errors do not
imply that the connection is no longer usable, they are
used for all errors that are not specific to a stream.
== Elements
ConnPid::
The pid of the Gun connection process.
StreamRef::
Identifier of the stream that resulted in an error.
Reason::
The reason for the error.
+
It is present for debugging purposes only. You should not
rely on this value to perform operations programmatically.
== Changelog
* *1.0*: Message introduced.
== Examples
.Receive a gun_error message in a gen_server
[source,erlang]
----
handle_info({gun_error, ConnPid, _Reason},
State=#state{conn_pid=ConnPid}) ->
%% Do something.
{noreply, State};
handle_info({gun_error, ConnPid, _StreamRef, _Reason},
State=#state{conn_pid=ConnPid}) ->
%% Do something.
{noreply, State}.
----
== See also
link:man:gun(3)[gun(3)],
link:man:gun_up(3)[gun_up(3)],
link:man:gun_tunnel_up(3)[gun_tunnel_up(3)],
link:man:gun_down(3)[gun_down(3)]
|