end(event)


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

    ¥Name: tracing:${name}:end

end 事件表示函数调用返回值的时间点。在异步函数的情况下,这是当 promise 返回时,而不是当函数本身在内部进行 return 语句时。此时,如果跟踪函数是同步的,result 字段将设置为函数的返回值。或者,可能会出现 error 字段以表示任何抛出的错误。

¥The end event represents the point at which a function call returns a value. In the case of an async function this is when the promise returned not when the function itself makes a return statement internally. At this point, if the traced function was synchronous the result field will be set to the return value of the function. Alternatively, the error field may be present to represent any thrown errors.

建议专门监听 error 事件以跟踪错误,因为可跟踪的操作可能会产生多个错误。例如,失败的异步任务可能会在任务的同步部分抛出错误之前在内部启动。

¥It is recommended to listen specifically to the error event to track errors as it may be possible for a traceable action to produce multiple errors. For example, an async task which fails may be started internally before the sync part of the task then throws an error.