Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
is-retry-allowed
Advanced tools
Package description
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.
Readme
Check whether a request can be retried based on the
error.code
$ npm install --save is-retry-allowed
const isRetryAllowed = require('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`
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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).