Callback function when there is a failure in a connection to whatsapp 
        server
552558
def on_failure(self, entity):
        
        logger.error("Login failed, reason: %s" % entity.getReason())
        self.connected = False
1209478
function execCallback(err, stream) {
    if (err) throw err;
    stream
        .on('close', function (code, signal) { console.log('Stream closed with code ' + code + ' and signal ' + signal); conn.end() })
        .on('data', function (data) { console.log(data); })
        .stderr.on('data', function (err) { console.log('!!!!!!!!!!!!!! Error: ' + err); });
}
184643
def trigger_failure(data=nil)
      event.success = false
      event.data = data
      event.trigger
    end
569699
function (isGlobal, server, err, msg, session, resp, opts, cb) {
  let handler;
  if (isGlobal) {
    handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER);
  } else {
    handler = server.app.get(Constants.RESERVED.ERROR_HANDLER);
  }
  if (!handler) {
    logger.debug('no default error handler to resolve unknown exception. ' + err.stack);
    utils.invokeCallback(cb, err, resp, opts);
  } else {
    if (handler.length === 5) {
      handler(err, msg, resp, session, cb);
    } else {
      handler(err, msg, resp, session, opts, cb);
    }
  }
}
314584
function tryReconnect() {
    self.retry.retries++;
    if (self.retry.retries >= self.retry.max) {
      return self.emit('error', new Error('Did not reconnect after maximum retries: ' + self.retry.max));
    }

    doReconnect();
  }
62411
function callback(err, hasError) {

    if (err !== null) {
        console.log(chalk.red('Error running JSHint over project: %j\n'), err);
    }

    if (hasError) {
        console.log(chalk.blue('\nSummary\n=======\n'));
        for (var errorCode in errors) {
            if (errors.hasOwnProperty(errorCode)) {
                displaySummary(errorCode);
            }
        }

        console.log('');

        if (totalErrors > 1) {
            console.log(chalk.red('Found %d errors.\n'), totalErrors);
        } else {
            console.log(chalk.red('Found 1 error.\n'));
        }
    } else {
        console.log(chalk.green('No JSHint errors found.\n'));
    }
}
149524
function handlePushError(pushError, pushHandler) {
    return Platform.async(function(callback) {
        callback();
    })().then(function() {
        
        if (pushError.isConflict()) {
            if (pushHandler && pushHandler.onConflict) {
                // NOTE: value of server record will not be available in case of 409.
                return pushHandler.onConflict(pushError);
            }
        } else if (pushHandler && pushHandler.onError) {
            return pushHandler.onError(pushError);
        }

    }).then(undefined, function(error) {
        // Set isHandled to false even if the user has set it to handled if the onConflict / onError failed 
        pushError.isHandled = false;
    });
}
89503
function onFailure(err) {
          _removeDOMElement(placeholder);
          if (console && console.debug) {
            console.debug('The following error occured: ', err);
          }

          /* Call custom callback */
          if ($scope.onError) {
            $scope.onError({err:err});
          }

          return;
        }
855361
function _checkConnection(conn) {
  // Return Promise for getConnection callback wrapping
  return new Promise((resolve, reject) => {
    if (conn) {
      resolve(conn);
    } else {
      _pool.getConnection((err, conn) => {
        if (err) reject(err); // Reject this error
        else resolve(conn); // Resolve the connection
      })
    }
  });
}
1201888
def _wrap_callback_errors(callback, message):
    
    try:
        callback(message)
    except Exception:
        # Note: the likelihood of this failing is extremely low. This just adds
        # a message to a queue, so if this doesn't work the world is in an
        # unrecoverable state and this thread should just bail.
        _LOGGER.exception(
            "Top-level exception occurred in callback while processing a " "message"
        )
        message.nack()
4741
function catchResults (resolve, reject, err, client, done) {
	//debug.log('catchResults()...');
	if (err) {
		return reject(err);
	}
	resolve({"client":client, "done":done});
}
232756
function handleCallback(callback, err, httpResponse, body) {

    if(err){
        return callback(err);
    }

    //
    // API returns error
    //
    if( body.status !== 'OK' ){
        return callback(new Error(body.comment));
    }

    return callback(null, body.result);
}
758322
function onPushNotificationError(error) {
    Q(pushCallback(error)).done(undefined, function (e) {
        diag.debug.assert(e === error, 'push callback failed: ' + e.message);
    });
}
930483
function onRequestError(error, result, endCallback) {
      result.currentRetries++;
      async.parallel([
        async.apply(recrawlError, error, result),
        async.apply(retrySameUrl,error, result)
      ],function(error){
          endCallback(error);
      });

  }
1354549
function shouldReconnect(err) {
  // exclude all programming errors
  return (!(err instanceof TypeError) &&
          !(err instanceof InvalidArgumentError) &&
          !(err instanceof NotPermittedError) &&
          !(err instanceof ReplacedError) &&
          !(err instanceof StoppedError) &&
          !(err instanceof SubscribedError) &&
          !(err instanceof UnsubscribedError)
  );
}
499919
function onConnect(err) {
    if (err) {
      DEBUG("connect error", err)
      return cb(err)
    }

    DEBUG("connected")

    channel.sendMessage({
      type: "request",
      name: "connect",
      to:   "server",
      id:   "0",
      body: {
        key: config.key
      }
    })
  }
1173030
def onUserError(self, fail, message):
        
        self.log.error(fail)
        self.log.error(message)