(task: AfterTask)
| 37 | } |
| 38 | |
| 39 | public after(task: AfterTask): void { |
| 40 | if (isThenable(task)) { |
| 41 | if (!this.waitUntil) { |
| 42 | errorWaitUntilNotAvailable() |
| 43 | } |
| 44 | this.waitUntil( |
| 45 | task.catch((error) => this.reportTaskError('promise', error)) |
| 46 | ) |
| 47 | } else if (typeof task === 'function') { |
| 48 | // TODO(after): implement tracing |
| 49 | this.addCallback(task) |
| 50 | } else { |
| 51 | throw new Error('`after()`: Argument must be a promise or a function') |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | private addCallback(callback: AfterCallback) { |
| 56 | // if something is wrong, throw synchronously, bubbling up to the `after` callsite. |
no test coverage detected