@aws-sdk/fetch-http-handler
Version:
Provides a way to make requests
13 lines (12 loc) • 463 B
JavaScript
export function requestTimeout(timeoutInMs) {
if (timeoutInMs === void 0) { timeoutInMs = 0; }
return new Promise(function (resolve, reject) {
if (timeoutInMs) {
setTimeout(function () {
var timeoutError = new Error("Request did not complete within ".concat(timeoutInMs, " ms"));
timeoutError.name = "TimeoutError";
reject(timeoutError);
}, timeoutInMs);
}
});
}