MCPcopy Create free account
hub / github.com/firebase/firebase-tools / timeoutError

Function timeoutError

src/timeout.ts:15–27  ·  view source on GitHub ↗
(
  promise: Promise<T>,
  error?: string | Error,
  timeoutMillis = 5000,
)

Source from the content-addressed store, hash-verified

13}
14
15export async function timeoutError<T>(
16 promise: Promise<T>,
17 error?: string | Error,
18 timeoutMillis = 5000,
19): Promise<T> {
20 if (typeof error === "string") error = new Error(error);
21 return Promise.race<T>([
22 promise,
23 new Promise((resolve, reject) => {
24 setTimeout(() => reject(error || new Error("Operation timed out.")), timeoutMillis);
25 }),
26 ]);
27}

Callers 2

timeout.spec.tsFile · 0.90
autoAuthFunction · 0.90

Calls 1

rejectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…