()
| 102 | } |
| 103 | |
| 104 | throwIfExpired(): void { |
| 105 | if (this.timedOut) { |
| 106 | // This method is invoked when someone wants to throw immediately instead of await the result of this promise |
| 107 | // Since they won't be handling the rejection from the promise (because we're about to throw here) |
| 108 | // attach handling to prevent this from bubbling up to Node.js |
| 109 | this.then(undefined, squashError); |
| 110 | throw new TimeoutError('Timed out', { duration: this.duration }); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | public static expires(duration: number, unref?: true): Timeout { |
| 115 | return new Timeout(undefined, { duration, unref }); |
no outgoing calls
no test coverage detected