| 1 |
= cowboy_stream:early_error(3) |
| 2 |
|
| 3 |
== Name |
| 4 |
|
| 5 |
cowboy_stream:early_error - Handle an early error for a stream |
| 6 |
|
| 7 |
== Description |
| 8 |
|
| 9 |
[source,erlang] |
| 10 |
---- |
| 11 |
early_error(StreamID, Reason, PartialReq, Resp, Opts) -> Resp |
| 12 |
|
| 13 |
StreamID :: cowboy_stream:stream_id() |
| 14 |
Reason :: cowboy_stream:reason() |
| 15 |
PartialReq :: cowboy_stream:partial_req() |
| 16 |
Resp :: cowboy_stream:resp_command() |
| 17 |
Opts :: cowboy:opts() |
| 18 |
---- |
| 19 |
|
| 20 |
Handle an early error for a stream. |
| 21 |
|
| 22 |
This function should be called by all stream handlers. It will |
| 23 |
propagate the early error to the next configured stream handler. |
| 24 |
|
| 25 |
== Arguments |
| 26 |
|
| 27 |
StreamID:: |
| 28 |
|
| 29 |
The stream ID. |
| 30 |
|
| 31 |
Reason:: |
| 32 |
|
| 33 |
Reason for termination. |
| 34 |
|
| 35 |
PartialReq:: |
| 36 |
|
| 37 |
The request data that has been received so far. |
| 38 |
|
| 39 |
Resp:: |
| 40 |
|
| 41 |
The response that will be sent as a result of the early error. |
| 42 |
+ |
| 43 |
It may be modified by the stream handler before or after |
| 44 |
being propagated to the next handler. |
| 45 |
|
| 46 |
Opts:: |
| 47 |
|
| 48 |
The protocol options. |
| 49 |
|
| 50 |
== Return value |
| 51 |
|
| 52 |
The response to be sent as a result of the early error. |
| 53 |
|
| 54 |
== Changelog |
| 55 |
|
| 56 |
* *2.0*: Function introduced. |
| 57 |
|
| 58 |
== Examples |
| 59 |
|
| 60 |
.Propagate the early error to the next stream handler |
| 61 |
[source,erlang] |
| 62 |
---- |
| 63 |
early_error(StreamID, Reason, PartialReq, Resp, Opts) -> |
| 64 |
cowboy_stream:early_error(StreamID, Reason, PartialReq, Resp, Opts). |
| 65 |
---- |
| 66 |
|
| 67 |
== See also |
| 68 |
|
| 69 |
link:man:cowboy_stream(3)[cowboy_stream(3)], |
| 70 |
link:man:cowboy_stream:init(3)[cowboy_stream:init(3)], |
| 71 |
link:man:cowboy_stream:data(3)[cowboy_stream:data(3)], |
| 72 |
link:man:cowboy_stream:info(3)[cowboy_stream:info(3)], |
| 73 |
link:man:cowboy_stream:terminate(3)[cowboy_stream:terminate(3)] |