error(event)


  • 名称:tracing:${name}:error

    ¥Name: tracing:${name}:error

error 事件表示可跟踪函数同步或异步产生的任何错误。如果在跟踪函数的同步部分抛出错误,错误将分配给事件的 error 字段,并触发 error 事件。如果通过回调或 promise 拒绝异步接收到错误,它也将分配给事件的 error 字段并触发 error 事件。

¥The error event represents any error produced by the traceable function either synchronously or asynchronously. If an error is thrown in the synchronous portion of the traced function the error will be assigned to the error field of the event and the error event will be triggered. If an error is received asynchronously through a callback or promise rejection it will also be assigned to the error field of the event and trigger the error event.

单个可跟踪函数调用可能会多次产生错误,因此在使用此事件时应考虑到这一点。例如,如果另一个异步任务在内部触发失败,然后函数的同步部分抛出错误,将触发两个 error 事件,一个用于同步错误,一个用于异步错误。

¥It is possible for a single traceable function call to produce errors multiple times so this should be considered when consuming this event. For example, if another async task is triggered internally which fails and then the sync part of the function then throws and error two error events will be emitted, one for the sync error and one for the async error.