lib/network/provider/retry-proxy.js
/**
   * Creates wrapper for send function
   * @param {Function} originalSendFn
   */
Creates wrapper for send function
@param {Function} originalSendFn
Creates wrapper for send function @param { Function } originalSendFn
static wrapSend(originalSendFn, retries) {
    return async (...args) => pRetry(
      async () => {
        try {
          const result = await originalSendFn(...args);
          return result; 
        } catch (error) {
          if (error.constructor.name === 'NetworkError'
              || /^\s*Connection\s+error\s*:/i.test(error.message)
          ) {
            return Promise.reject(error); 
          }
          return Promise.reject(new pRetry.AbortError(error)); 
        }
      },
      {
        retries,
        onFailedAttempt: error => debug(
          'Web3:Provider:send',
          `Retrying ${error.attemptNumber} time due to ${error.constructor.name}: "${error.message}"`,
        ),
      },
    );
  }
static wrapSend ( originalSendFn , retries ) { return async ( ... args ) => pRetry ( async ( ) => { try { const result = await originalSendFn ( ... args ) ; return result ; } catch ( error ) { if ( error . constructor . name === 'NetworkError' || / ^\s*Connection\s+error\s*: / i . test ( error . message ) ) { return Promise . reject ( error ) ; } return Promise . reject ( new pRetry . AbortError ( error ) ) ; } } , { retries , onFailedAttempt : error => debug ( 'Web3:Provider:send' , ` ${ error . attemptNumber } ${ error . constructor . name } ${ error . message } ` , ) , } , ) ; }
Creates wrapper for send function
 @param {Function} originalSendFn
Creates wrapper for send function @param { Function } originalSendFn
// Otherwise it doesn't fail in this scope... // @todo Fix it after web3.js gets rewritten... hopefully =) // || /^\s*Node\s+error\s*:/i.test(error.message) // retryable // non retryable