aboutsummaryrefslogtreecommitdiff
path: root/node_modules/is-retry-allowed
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-28 00:38:50 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-28 00:40:43 +0200
commit7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch)
tree6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/is-retry-allowed
parent963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff)
downloadwallet-core-7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027.tar.xz
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/is-retry-allowed')
-rw-r--r--node_modules/is-retry-allowed/index.js60
-rw-r--r--node_modules/is-retry-allowed/license21
-rw-r--r--node_modules/is-retry-allowed/package.json29
-rw-r--r--node_modules/is-retry-allowed/readme.md42
4 files changed, 152 insertions, 0 deletions
diff --git a/node_modules/is-retry-allowed/index.js b/node_modules/is-retry-allowed/index.js
new file mode 100644
index 000000000..663ee338f
--- /dev/null
+++ b/node_modules/is-retry-allowed/index.js
@@ -0,0 +1,60 @@
+'use strict';
+
+var WHITELIST = [
+ 'ETIMEDOUT',
+ 'ECONNRESET',
+ 'EADDRINUSE',
+ 'ESOCKETTIMEDOUT',
+ 'ECONNREFUSED',
+ 'EPIPE'
+];
+
+var BLACKLIST = [
+ 'ENOTFOUND',
+ 'ENETUNREACH',
+
+ // SSL errors from https://github.com/nodejs/node/blob/ed3d8b13ee9a705d89f9e0397d9e96519e7e47ac/src/node_crypto.cc#L1950
+ 'UNABLE_TO_GET_ISSUER_CERT',
+ 'UNABLE_TO_GET_CRL',
+ 'UNABLE_TO_DECRYPT_CERT_SIGNATURE',
+ 'UNABLE_TO_DECRYPT_CRL_SIGNATURE',
+ 'UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY',
+ 'CERT_SIGNATURE_FAILURE',
+ 'CRL_SIGNATURE_FAILURE',
+ 'CERT_NOT_YET_VALID',
+ 'CERT_HAS_EXPIRED',
+ 'CRL_NOT_YET_VALID',
+ 'CRL_HAS_EXPIRED',
+ 'ERROR_IN_CERT_NOT_BEFORE_FIELD',
+ 'ERROR_IN_CERT_NOT_AFTER_FIELD',
+ 'ERROR_IN_CRL_LAST_UPDATE_FIELD',
+ 'ERROR_IN_CRL_NEXT_UPDATE_FIELD',
+ 'OUT_OF_MEM',
+ 'DEPTH_ZERO_SELF_SIGNED_CERT',
+ 'SELF_SIGNED_CERT_IN_CHAIN',
+ 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
+ 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
+ 'CERT_CHAIN_TOO_LONG',
+ 'CERT_REVOKED',
+ 'INVALID_CA',
+ 'PATH_LENGTH_EXCEEDED',
+ 'INVALID_PURPOSE',
+ 'CERT_UNTRUSTED',
+ '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;
+};
diff --git a/node_modules/is-retry-allowed/license b/node_modules/is-retry-allowed/license
new file mode 100644
index 000000000..1aeb74fd2
--- /dev/null
+++ b/node_modules/is-retry-allowed/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/is-retry-allowed/package.json b/node_modules/is-retry-allowed/package.json
new file mode 100644
index 000000000..452b76f5a
--- /dev/null
+++ b/node_modules/is-retry-allowed/package.json
@@ -0,0 +1,29 @@
+{
+ "name": "is-retry-allowed",
+ "version": "1.1.0",
+ "description": "My prime module",
+ "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"
+ }
+}
diff --git a/node_modules/is-retry-allowed/readme.md b/node_modules/is-retry-allowed/readme.md
new file mode 100644
index 000000000..4212d099b
--- /dev/null
+++ b/node_modules/is-retry-allowed/readme.md
@@ -0,0 +1,42 @@
+# 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 for Error?
+
+
+## Install
+
+```
+$ npm install --save is-retry-allowed
+```
+
+
+## Usage
+
+```js
+const isRetryAllowed = require('is-retry-allowed');
+
+isRetryAllowed({code: 'ETIMEDOUT'});
+//=> true
+
+isRetryAllowed({code: 'ENOTFOUND'});
+//=> false
+
+isRetryAllowed({});
+//=> true
+```
+
+
+## API
+
+### isRetryAllowed(error)
+
+#### error
+
+Type: `object`
+
+Object with `code` property, which will be used to determine retry.
+
+
+## License
+
+MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)