1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.requestTimeout = void 0;
|
4 | function requestTimeout(timeoutInMs = 0) {
|
5 | return new Promise((resolve, reject) => {
|
6 | if (timeoutInMs) {
|
7 | setTimeout(() => {
|
8 | const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`);
|
9 | timeoutError.name = "TimeoutError";
|
10 | reject(timeoutError);
|
11 | }, timeoutInMs);
|
12 | }
|
13 | });
|
14 | }
|
15 | exports.requestTimeout = requestTimeout;
|