@@ -124,7 +124,7 @@ stream.
124124
125125#### error event
126126
127- The ` error ` event will be emitted whenever an error occurs, usually while
127+ The ` error ` event will be emitted once a fatal error occurs, usually while
128128trying to read from this stream.
129129The event receives a single ` Exception ` argument for the error instance.
130130
@@ -134,23 +134,23 @@ $server->on('error', function (Exception $e) {
134134});
135135```
136136
137- This event MAY be emitted any number of times, which should be zero
138- times if this is a stream that is successfully terminated.
139- It SHOULD be emitted whenever the stream detects an error, such as a
140- transmission error or after an unexpected ` data ` or premature ` end ` event.
141- It SHOULD NOT be emitted after a ` close ` event.
137+ This event SHOULD be emitted once the stream detects a fatal error, such
138+ as a fatal transmission error or after an unexpected ` data ` or premature
139+ ` end ` event.
140+ It SHOULD NOT be emitted after a previous ` error ` , ` end ` or ` close ` event.
141+ It MUST NOT be emitted if this is not a fatal error condition, such as
142+ a temporary network issue that did not cause any data to be lost.
143+
144+ After the stream errors, it MUST close the stream and SHOULD thus be
145+ followed by a ` close ` event and then switch to non-readable mode, see
146+ also ` close() ` and ` isReadable() ` .
142147
143148Many common streams (such as a TCP/IP connection or a file-based stream)
144149only deal with data transmission and do not make assumption about data
145150boundaries (such as unexpected ` data ` or premature ` end ` events).
146151In other words, many lower-level protocols (such as TCP/IP) may choose
147- to only emit this for a fatal transmission error once and will thus
148- likely close (terminate) the stream in response.
149- If this is a fatal error that results in the stream being closed, it
150- SHOULD be followed by a ` close ` event.
151-
152- Other higher-level protocols may choose to keep the stream alive after
153- this event, if they can recover from an error condition.
152+ to only emit this for a fatal transmission error once and will then
153+ close (terminate) the stream in response.
154154
155155If this stream is a ` DuplexStreamInterface ` , you should also notice
156156how the writable side of the stream also implements an ` error ` event.
@@ -177,7 +177,7 @@ see also `isReadable()`.
177177Unlike the ` end ` event, this event SHOULD be emitted whenever the stream
178178closes, irrespective of whether this happens implicitly due to an
179179unrecoverable error or explicitly when either side closes the stream.
180- If you only want to detect a * succesful * end, you should use the ` end `
180+ If you only want to detect a * successful * end, you should use the ` end `
181181event instead.
182182
183183Many common streams (such as a TCP/IP connection or a file-based stream)
@@ -434,7 +434,7 @@ This event is mostly used internally, see also `pipe()` for more details.
434434
435435#### error event
436436
437- The ` error ` event will be emitted whenever an error occurs, usually while
437+ The ` error ` event will be emitted once a fatal error occurs, usually while
438438trying to write to this stream.
439439The event receives a single ` Exception ` argument for the error instance.
440440
@@ -444,21 +444,20 @@ $stream->on('error', function (Exception $e) {
444444});
445445```
446446
447- This event MAY be emitted any number of times, which should be zero
448- times if this is a stream that is successfully terminated.
449- It SHOULD be emitted whenever the stream detects an error, such as a
450- transmission error.
451- It SHOULD NOT be emitted after a ` close ` event.
447+ This event SHOULD be emitted once the stream detects a fatal error, such
448+ as a fatal transmission error.
449+ It SHOULD NOT be emitted after a previous ` error ` or ` close ` event.
450+ It MUST NOT be emitted if this is not a fatal error condition, such as
451+ a temporary network issue that did not cause any data to be lost.
452+
453+ After the stream errors, it MUST close the stream and SHOULD thus be
454+ followed by a ` close ` event and then switch to non-writable mode, see
455+ also ` close() ` and ` isWritable() ` .
452456
453457Many common streams (such as a TCP/IP connection or a file-based stream)
454458only deal with data transmission and may choose
455- to only emit this for a fatal transmission error once and will thus
456- likely close (terminate) the stream in response.
457- If this is a fatal error that results in the stream being closed, it
458- SHOULD be followed by a ` close ` event.
459-
460- Other higher-level protocols may choose to keep the stream alive after
461- this event, if they can recover from an error condition.
459+ to only emit this for a fatal transmission error once and will then
460+ close (terminate) the stream in response.
462461
463462If this stream is a ` DuplexStreamInterface ` , you should also notice
464463how the readable side of the stream also implements an ` error ` event.
0 commit comments