Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
is-retry-allowed
Advanced tools
Check whether a request can be retried based on the `error.code`
The is-retry-allowed npm package is used to determine if a given error is transient and likely to be resolved by retrying the failed operation. It checks the error against a list of known transient errors and returns a boolean indicating whether a retry should be allowed.
Check if a retry is allowed for a given error
This feature allows you to pass an error object to the isRetryAllowed function, which returns true if the error is considered transient and retryable, or false otherwise.
const isRetryAllowed = require('is-retry-allowed');
const error = new Error('ECONNRESET');
const shouldRetry = isRetryAllowed(error);
console.log(shouldRetry); // Output: true
The retry package provides a set of functions for retrying asynchronous functions. It is more feature-rich than is-retry-allowed, offering a flexible approach to control the number of retries, timeouts, and the interval between retries.
Similar to retry, async-retry is a library for retrying a function which returns a Promise. It supports custom retry strategies and has a simple API, but it does not provide a built-in mechanism to determine if an error is retryable.
p-retry is a library for retrying promises with a configurable number of attempts. It is promise-based and allows for custom retry conditions, but unlike is-retry-allowed, it does not come with a predefined list of retryable errors.
Check whether a request can be retried based on the
error.code
$ npm install is-retry-allowed
import isRetryAllowed from 'is-retry-allowed';
isRetryAllowed({code: 'ETIMEDOUT'});
//=> true
isRetryAllowed({code: 'ENOTFOUND'});
//=> false
isRetryAllowed({});
//=> true
Type: Error | object
The .code
property, if it exists, will be used to determine whether retry is allowed.
FAQs
Check whether a request can be retried based on the `error.code`
The npm package is-retry-allowed receives a total of 5,745,286 weekly downloads. As such, is-retry-allowed popularity was classified as popular.
We found that is-retry-allowed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.