Function
wrapCallback
(span: Span, callback: any, idxError: any = false)
Source from the content-addressed store, hash-verified
| 59 | }; |
| 60 | |
| 61 | export const wrapCallback = (span: Span, callback: any, idxError: any = false) => { |
| 62 | return function (this: any) { |
| 63 | if (idxError !== false && arguments[idxError]) span.error(arguments[idxError]); |
| 64 | |
| 65 | span.stop(); |
| 66 | |
| 67 | return callback.apply(this, arguments); |
| 68 | }; |
| 69 | }; |
| 70 | |
| 71 | export const wrapPromise = (span: Span, promise: any) => { |
| 72 | return promise.then( |
Tested by
no test coverage detected