( fn: () => Promise<T>, contextFactory: () => CommandContext )
| 123 | const noop = () => {}; |
| 124 | |
| 125 | export function traceCommand<T>( |
| 126 | fn: () => Promise<T>, |
| 127 | contextFactory: () => CommandContext |
| 128 | ): Promise<T> { |
| 129 | if (!shouldTrace(commandChannel)) return fn(); |
| 130 | |
| 131 | // tracePromise returns a wrapper promise that re-rejects on error. |
| 132 | // Silence the wrapper to prevent unhandled rejections when callers |
| 133 | // (e.g. Pipeline) discard the return value. Callers that await this |
| 134 | // promise still see the rejection through their own .then() chain. |
| 135 | const traced = commandChannel.tracePromise(fn, contextFactory()); |
| 136 | traced.catch(noop); |
| 137 | return traced; |
| 138 | } |
| 139 | |
| 140 | export function traceBatch<T>( |
| 141 | fn: () => Promise<T>, |
no test coverage detected
searching dependent graphs…