Socket
Socket
Sign inDemoInstall

is-retry-allowed

Package Overview
Dependencies
0
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 2.0.0

34

index.js
'use strict';
var WHITELIST = [
'ETIMEDOUT',
'ECONNRESET',
'EADDRINUSE',
'ESOCKETTIMEDOUT',
'ECONNREFUSED',
'EPIPE',
'EHOSTUNREACH',
'EAI_AGAIN'
];
var BLACKLIST = [
const denyList = new Set([
'ENOTFOUND',
'ENETUNREACH',
// SSL errors from https://github.com/nodejs/node/blob/ed3d8b13ee9a705d89f9e0397d9e96519e7e47ac/src/node_crypto.cc#L1950
// SSL errors from https://github.com/nodejs/node/blob/e585caa2bebbd238c763af588a40879b61cf240f/src/node_crypto.cc#L2563-L2589
'UNABLE_TO_GET_ISSUER_CERT',

@@ -46,18 +35,5 @@ 'UNABLE_TO_GET_CRL',

'CERT_REJECTED'
];
]);
module.exports = function (err) {
if (!err || !err.code) {
return true;
}
if (WHITELIST.indexOf(err.code) !== -1) {
return true;
}
if (BLACKLIST.indexOf(err.code) !== -1) {
return false;
}
return true;
};
// TODO: Use `error?.code` when targeting Node.js 14
module.exports = error => !denyList.has(error && error.code);

61

package.json
{
"name": "is-retry-allowed",
"version": "1.2.0",
"description": "Is retry allowed for Error?",
"license": "MIT",
"repository": "floatdrop/is-retry-allowed",
"author": {
"name": "Vsevolod Strukchinsky",
"email": "floatdrop@gmail.com",
"url": "github.com/floatdrop"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
""
],
"dependencies": {},
"devDependencies": {
"ava": "^0.8.0",
"xo": "^0.12.1"
}
"name": "is-retry-allowed",
"version": "2.0.0",
"description": "Check whether a request can be retried based on the `error.code`",
"license": "MIT",
"repository": "sindresorhus/is-retry-allowed",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"retry",
"retries",
"allowed",
"check",
"http",
"https",
"request",
"fetch"
],
"devDependencies": {
"ava": "^2.3.0",
"xo": "^0.36.1"
}
}

@@ -1,6 +0,5 @@

# is-retry-allowed [![Build Status](https://travis-ci.org/floatdrop/is-retry-allowed.svg?branch=master)](https://travis-ci.org/floatdrop/is-retry-allowed)
# is-retry-allowed
Is retry allowed for Error?
> Check whether a request can be retried based on the `error.code`
## Install

@@ -12,3 +11,2 @@

## Usage

@@ -29,3 +27,2 @@

## API

@@ -37,9 +34,16 @@

Type: `object`
Type: `Error | object`
Object with `code` property, which will be used to determine retry.
The `.code` property, if it exists, will be used to determine whether retry is allowed.
---
## License
MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-is-retry-allowed?utm_source=npm-is-retry-allowed&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc