( url: string, init: RequestInit, timeoutMs: number, )
| 1252 | } |
| 1253 | |
| 1254 | function fetchWithTimeout( |
| 1255 | url: string, |
| 1256 | init: RequestInit, |
| 1257 | timeoutMs: number, |
| 1258 | ): Promise<Response> { |
| 1259 | return new Promise((resolve, reject) => { |
| 1260 | const timeoutId = setTimeout( |
| 1261 | () => reject(new Error("Symbolication timed out.")), |
| 1262 | timeoutMs, |
| 1263 | ); |
| 1264 | fetch(url, init).then( |
| 1265 | (response) => { |
| 1266 | clearTimeout(timeoutId); |
| 1267 | resolve(response); |
| 1268 | }, |
| 1269 | (error) => { |
| 1270 | clearTimeout(timeoutId); |
| 1271 | reject(error); |
| 1272 | }, |
| 1273 | ); |
| 1274 | }); |
| 1275 | } |
| 1276 | |
| 1277 | function bestSourceLocation( |
| 1278 | locations: Array<JSONObject | null | undefined>, |
no test coverage detected