Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await pRetry(async() => {
let results;
try {
results = await npm(`view ${parentPackageName}@${_parentVersion} dependencies --json`);
} catch (err) {
// occurs sometimes when running multiple npm calls at once
if (typeof err !== 'string' || !err.includes('npm update check failed')) {
throw new pRetry.AbortError(err);
}
// https://github.com/sindresorhus/p-retry/issues/14
// throw err;
throw new Error(err);
}
if (parentVersion) {
return;
}
// some versions may be missing deps
if (!results) {
return;
}
async () => {
try {
return await fn();
} catch (error) {
if (error.code !== "TooManyRequestsException") {
// Stop retrying and throw the error
throw new pRetry.AbortError(error);
}
throw error;
}
},
{
const retryForever = pRetry(() => {
// It could happen that this function timed out. Because this is a
// async function we check the client status to stop this loop.
if (this.status === ClientStatus.DISCONNECTED) {
throw new pRetry.AbortError("It's no use. Stop trying to recover");
}
return tryOpeningSocketWithTimeout();
}, retryOptions);
}).catch(err => {
// occurs sometimes when running multiple npm calls at once
if (typeof err !== 'string' || !err.includes('npm update check failed')) {
throw new pRetry.AbortError(err);
}
// https://github.com/sindresorhus/p-retry/issues/14
// throw err;
throw new Error(err);
});
}, { retries: 5 });
const checkUploadState = async (): Promise => {
const upload = await instrumentQuery(() =>
this.connection.getRepository(pgModels.LsifUpload).findOneOrFail({ id: uploadId })
)
if (upload.state === 'errored') {
const error = new Error(upload.failureSummary)
error.stack = upload.failureStacktrace
throw new AbortError(error)
}
if (upload.state !== 'completed') {
throw new UploadInProgressError()
}
}
async () => {
try {
const stackDetails = await cloudFormationService.describeStacks({
StackName
}).promise();
return stackDetails.Stacks[0].StackStatus;
} catch (err) {
if (isThrottlingException(err)) throw new Error('Trigger retry');
throw new pRetry.AbortError(err);
}
},
{
async () => {
try {
return kinesis.createStream({ StreamName: streamName, ShardCount: 1 }).promise();
} catch (error) {
if (error.code === 'LimitExceededException') throw new Error('Trigger retry');
throw new pRetry.AbortError(error);
}
},
{
.catch(e => {
if (e.code === Transaction.ABORTED) throw e;
throw new retry.AbortError(e.message);
})
);
fetch(`${BASE_URL}${path}`, options).then(res => {
if (res.status === 404) {
throw new pRetry.AbortError(res.statusText)
} else if (!res.ok) {
throw new Error(res.statusText)
}
return res
}),
{
return pRetry(async () => {
try {
return await throttler.wrap(func)(...args);
} catch (err) {
if (SKIP_RETRY_CODES.includes(err.code)) {
throw new pRetry.AbortError(err);
}
throw err;
}
}, retry);
}