session.onerror
- 类型:<Function> | <undefined>
在会话因错误而被销毁时可选调用的回调函数。这包括由用户回调抛出或拒绝导致的错误(参见 回调错误处理)。回调函数接收一个参数:触发销毁的错误。如果 onerror 回调本身抛出错误或返回的 Promise 被拒绝,该错误将作为未捕获的异常出现。可读/可写。
🌐 An optional callback invoked when the session 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.
也可以通过 quic.connect() 或 quic.listen() 中的 onerror 选项进行设置。
🌐 Can also be set via the onerror option in quic.connect() or
quic.listen().