ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 3.145.52.253 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/funds.upgrade.nicn.gov.ng/funds-upgraded/node_modules/p-retry/ |
Upload File : |
'use strict'; const retry = require('retry'); const networkErrorMsgs = [ 'Failed to fetch', // Chrome 'NetworkError when attempting to fetch resource', // Firefox 'The Internet connection appears to be offline', // Safari 'Network request failed' // `cross-fetch` ]; class AbortError extends Error { constructor(message) { super(); if (message instanceof Error) { this.originalError = message; ({message} = message); } else { this.originalError = new Error(message); this.originalError.stack = this.stack; } this.name = 'AbortError'; this.message = message; } } const decorateErrorWithCounts = (error, attemptNumber, options) => { // Minus 1 from attemptNumber because the first attempt does not count as a retry const retriesLeft = options.retries - (attemptNumber - 1); error.attemptNumber = attemptNumber; error.retriesLeft = retriesLeft; return error; }; const isNetworkError = errorMessage => networkErrorMsgs.includes(errorMessage); const pRetry = (input, options) => new Promise((resolve, reject) => { options = { onFailedAttempt: () => {}, retries: 10, ...options }; const operation = retry.operation(options); operation.attempt(async attemptNumber => { try { resolve(await input(attemptNumber)); } catch (error) { if (!(error instanceof Error)) { reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`)); return; } if (error instanceof AbortError) { operation.stop(); reject(error.originalError); } else if (error instanceof TypeError && !isNetworkError(error.message)) { operation.stop(); reject(error); } else { decorateErrorWithCounts(error, attemptNumber, options); try { await options.onFailedAttempt(error); } catch (error) { reject(error); return; } if (!operation.retry(error)) { reject(operation.mainError()); } } } }); }); module.exports = pRetry; // TODO: remove this in the next major version module.exports.default = pRetry; module.exports.AbortError = AbortError;