@atlassian/wrm-troubleshooting
Version:
A tool that can help you with troubleshooting the configuration of webpack and Atlassian P2 project.
23 lines • 870 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchWithTimeout = exports.FetchTimeoutError = void 0;
const abort_controller_1 = require("abort-controller");
const node_fetch_1 = __importDefault(require("node-fetch"));
class FetchTimeoutError extends Error {
}
exports.FetchTimeoutError = FetchTimeoutError;
async function fetchWithTimeout(timeout, url, options) {
const abortCtrl = new abort_controller_1.AbortController();
setTimeout(() => {
abortCtrl.abort();
}, timeout);
return (0, node_fetch_1.default)(url, {
...options,
signal: abortCtrl.signal,
});
}
exports.fetchWithTimeout = fetchWithTimeout;
//# sourceMappingURL=fetchWithTimeout.js.map