事件:'error'
\Event: 'error'
新增于: v0.9.4
如果在写入或管道数据时发生错误,则会触发 'error' 事件。监听器回调在调用时传入单个 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.
除非在创建流时将 autoDestroy 选项设置为 false,否则当触发 'error' 事件时将关闭流。
\The stream is closed when the 'error' event is emitted unless the
autoDestroy option was set to false when creating the
stream.
在 'error' 之后,除 'close' 之外不应再触发其他事件(包括 'error' 事件)。
\After 'error', no further events other than 'close' should be emitted
(including 'error' events).