'error' 事件


如果在写入或管道数据时发生错误,则会触发 'error' 事件。 监听器回调在调用时传入单个 Error 参数。

除非在创建流时将 autoDestroy 选项设置为 false,否则当触发 'error' 事件时将关闭流。

'error' 之后,不应触发除 'close' 之外的其他事件(包括 'error' 事件)。

The 'error' event is emitted if an error occurred while writing or piping data. The listener callback is passed a single Error argument when called.

The stream is closed when the 'error' event is emitted unless the autoDestroy option was set to false when creating the stream.

After 'error', no further events other than 'close' should be emitted (including 'error' events).