()
| 189 | } |
| 190 | |
| 191 | function handleTimeout() { |
| 192 | let error: Error; |
| 193 | if (lastError) { |
| 194 | if (lastError instanceof Error) { |
| 195 | error = lastError; |
| 196 | } else { |
| 197 | error = new Error(String(lastError)); |
| 198 | } |
| 199 | |
| 200 | copyStackTraceIfNeeded(error, stackTraceError); |
| 201 | } else { |
| 202 | error = new Error('Timed out in waitFor.'); |
| 203 | copyStackTraceIfNeeded(error, stackTraceError); |
| 204 | } |
| 205 | |
| 206 | let errorForRejection: unknown = error; |
| 207 | if (typeof onTimeout === 'function') { |
| 208 | try { |
| 209 | const result = onTimeout(error); |
| 210 | if (result) { |
| 211 | errorForRejection = result; |
| 212 | } |
| 213 | } catch (onTimeoutError) { |
| 214 | errorForRejection = onTimeoutError; |
| 215 | } |
| 216 | } |
| 217 | onDone({ type: 'error', error: errorForRejection }); |
| 218 | } |
| 219 | }); |
| 220 | } |
| 221 |
no test coverage detected
searching dependent graphs…