stream.onerror
- 类型:<Function> | <undefined>
在流因错误而被销毁时可选调用的回调函数。这包括用户回调抛出或拒绝引起的错误(见 回调错误处理)。回调函数接收一个参数:触发销毁的错误。如果 onerror 回调本身抛出错误或返回一个被拒绝的 Promise,该错误将作为未捕获异常显现。读/写。
🌐 An optional callback invoked when the stream is destroyed with an error.
This includes errors caused by user callbacks that throw or reject (see
Callback error handling). The callback receives a single argument: the
error that triggered the destruction. If the onerror callback itself throws
or returns a promise that rejects, the error is surfaced as an uncaught
exception. Read/write.