Internal: Raises a Raidis::ConnectionError if there are connection-related problems during the execution of the block.
 More specifically, if the connection is lost or a write is performed against a slave, the Exception will be raised.
426655
def observing_connection(&block)
      yield

    rescue *connection_errors => exception
      if defined?(Trouble)
        if Trouble.respond_to? :log  # Requires Trouble > 0.0.11
          Trouble.log exception, code: :lost_connection, message: 'Raidis lost connection to the Redis server.', client: redis.inspect
        else
          Trouble.notify exception, code: :lost_connection, message: 'Raidis lost connection to the Redis server.', client: redis.inspect
        end
      end

      raise Raidis::ConnectionError, exception

    rescue Redis::CommandError => exception
      if exception.message.to_s.split.first == 'READONLY'
        Trouble.notify(exception, code: :readonly, message: 'Raidis detected an illegal write against a Redis slave.', client: redis.inspect) if defined?(Trouble)
        raise Raidis::ConnectionError, exception
      else
        # Passing through Exceptions unrelated to the Connection. E.g. Redis::CommandError.
        raise exception
      end
    end
444947
public void checkDataDir() throws DiskErrorException {
    long total_blocks=0, removed_blocks=0;
    List<FSVolume> failed_vols = null;

    failed_vols = volumes.checkDirs();

    //if there no failed volumes return
    if(failed_vols == null) 
      return;
    
    // else 
    // remove related blocks
    long mlsec = System.currentTimeMillis();
    lock.writeLock().lock();
    try {
      volumeMap.removeUnhealthyVolumes(failed_vols);
    } finally {
      lock.writeLock().unlock();
    }
    mlsec = System.currentTimeMillis() - mlsec;
    DataNode.LOG.warn(">>>>>>>>>>>>Removed " + removed_blocks + " out of " + total_blocks +
        "(took " + mlsec + " millisecs)");

    // report the error
    StringBuilder sb = new StringBuilder();
    for(FSVolume fv : failed_vols) {
      sb.append(fv.toString() + ";");
    }

    throw  new DiskErrorException("DataNode failed volumes:" + sb);
  
  }
153241
def _connectionEstablished(self, transport):
        ''''''
        self.transport = transport
        self.transport.writeOpen()
        self.heartbeater.schedule()
896951
def method_missing(*args, &block)
      Thread.pass until defined?(@result)
      
      case @result
      when Exception
        def self.method_missing(*args, &block); raise @result; end
      else
        def self.method_missing(*args, &block); @result.send(*args, &block); end
      end
      
      self.method_missing(*args, &block)
    end
365745
def _incr_exceptions(self, conn):
        
        self._pool_manager.get_connection(self.pid, conn).exceptions += 1
731202
def raise_error(self, status=500, message="Generic server error.  Out of luck..."):
        
        self.set_status(status)
        self.write({"message" : message,
                    "status" : status})
292485
def connection_wrapper(&block)
        begin
          response = block.call
          raise ClientError.new(response.body['error']) if response.body.has_key?('error')
        rescue Faraday::ParsingError => e
          # Has gotten a response, but it is not formatted with JSON
          raise ClientError.new(e.message)
        rescue Faraday::ClientError => e
          # Failed to build a connection
          raise ConnectionError.new(e.message)
        end

        response
      end
1254240
def on_raise(self, node):    # ('type', 'inst', 'tback')
        """"""
        if version_info[0] == 3:
            excnode = node.exc
            msgnode = node.cause
        else:
            excnode = node.type
            msgnode = node.inst
        out = self.run(excnode)
        msg = ' '.join(out.args)
        msg2 = self.run(msgnode)
        if msg2 not in (None, 'None'):
            msg = "%s: %s" % (msg, msg2)
        self.raise_exception(None, exc=out.__class__, msg=msg, expr='')
385667
def raise_exception(self, exception, tup=None):
        
        if tup:
            message = (
                "Python {exception_name} raised while processing Tuple "
                "{tup!r}\n{traceback}"
            )
        else:
            message = "Python {exception_name} raised\n{traceback}"
        message = message.format(
            exception_name=exception.__class__.__name__, tup=tup, traceback=format_exc()
        )
        self.send_message({"command": "error", "msg": str(message)})
        self.send_message({"command": "sync"})
1079850
def _on_connection_failed(self, conn_id, handle, clean, reason):
        

        with self.count_lock:
            self.connecting_count -= 1

        self._logger.info("_on_connection_failed conn_id=%d, reason=%s", conn_id, str(reason))

        conndata = self._get_connection(handle)

        if conndata is None:
            self._logger.info("Unable to obtain connection data on unknown connection %d", conn_id)
            return

        callback = conndata['callback']
        conn_id = conndata['connection_id']
        failure_reason = conndata['failure_reason']

        # If this was an early disconnect from the device, automatically retry
        if 'error_code' in conndata and conndata['error_code'] == 0x23e and conndata['retries'] > 0:
            self._remove_connection(handle)
            self.connect_async(conn_id, conndata['connection_string'], callback, conndata['retries'] - 1)
        else:
            callback(conn_id, self.id, False, failure_reason)
            self._remove_connection(handle)
1374352
def handle_os_exceptions():
    
    try:
        yield

    # Convert pycosio exception to equivalent OSError
    except ObjectException:
        exc_type, exc_value, _ = exc_info()
        raise _OS_EXCEPTIONS.get(exc_type, OSError)(exc_value)

    # Re-raise generic exceptions
    except (OSError, same_file_error, UnsupportedOperation):
        raise

    # Raise generic OSError for other exceptions
    except Exception:
        exc_type, exc_value, _ = exc_info()
        raise OSError('%s%s' % (
            exc_type, (', %s' % exc_value) if exc_value else ''))
893621
@Override
    void connectionError(SibRaMessagingEngineConnection connection, SIException exception)
    {
        String methodName = "connectionError";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, new Object[] { connection, exception });
        }

        /*
         * We have lost our remote connection, output a warning to the
         * admin console, close the connection and schedule an attempt
         * to create a new one
         */

        SibTr.warning(TRACE, "CONNECTION_ERROR_CWSIV0776",
                      new Object[] { connection.getConnection().getMeName(),
                                    _endpointConfiguration.getBusName(), this,
                                    exception });

        dropConnection(connection, false, true, true);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(this, TRACE, methodName);
        }
    }
1205446
def _except_if_failed(cls, event):
        """"""
        if event.success is None:
            raise IOTSyncTimeout('Requested timed out', event)
        if not event.success:
            msg = "Request failed, unknown error"
            if isinstance(event.payload, Mapping):
                if P_MESSAGE in event.payload:
                    msg = event.payload[P_MESSAGE]
                try:
                    exc_class = cls.__exception_mapping[event.payload[P_CODE]]
                except KeyError:
                    pass
                else:
                    raise exc_class(msg, event)

            raise IOTException(msg, event)
265334
def with_slave(uid, &block)
      slave = get_slave(uid, @io)
      slave.debug = debug
      slave.raise_exception_on_mismatch = raise_exception_on_mismatch
      slave.read_retries = read_retries
      slave.read_retry_timeout = read_retry_timeout
      if block_given?
        yield slave
      else
        slave
      end
    end
794931
def errReceived(self, data):
        

        if self.stderr:
            self.stderr.write(data)

        if self.kill_on_stderr:
            self.transport.loseConnection()
            raise RuntimeError(
                "Received stderr output from slave Tor process: " + data.decode('utf8')
            )
52247
def reconnect
      tries = 0
      begin
        data_store.reconnect
      rescue Redis::BaseConnectionError
        if (tries += 1) <= 3
          log_with_severity :error, "Error reconnecting to Redis; retrying"
          sleep(tries)
          retry
        else
          log_with_severity :error, "Error reconnecting to Redis; quitting"
          raise
        end
      end
    end
708328
def HandleExceptionsAndRebuildHttpConnections(retry_args):
    
    # If the server indicates how long to wait, use that value.  Otherwise,
    # calculate the wait time on our own.
    retry_after = None

    # Transport failures
    if isinstance(retry_args.exc, (http_client.BadStatusLine,
                                   http_client.IncompleteRead,
                                   http_client.ResponseNotReady)):
        logging.debug('Caught HTTP error %s, retrying: %s',
                      type(retry_args.exc).__name__, retry_args.exc)
    elif isinstance(retry_args.exc, socket.error):
        logging.debug('Caught socket error, retrying: %s', retry_args.exc)
    elif isinstance(retry_args.exc, socket.gaierror):
        logging.debug(
            'Caught socket address error, retrying: %s', retry_args.exc)
    elif isinstance(retry_args.exc, socket.timeout):
        logging.debug(
            'Caught socket timeout error, retrying: %s', retry_args.exc)
    elif isinstance(retry_args.exc, httplib2.ServerNotFoundError):
        logging.debug(
            'Caught server not found error, retrying: %s', retry_args.exc)
    elif isinstance(retry_args.exc, ValueError):
        # oauth2client tries to JSON-decode the response, which can result
        # in a ValueError if the response was invalid. Until that is fixed in
        # oauth2client, need to handle it here.
        logging.debug('Response content was invalid (%s), retrying',
                      retry_args.exc)
    elif (isinstance(retry_args.exc, TokenRefreshError) and
          hasattr(retry_args.exc, 'status') and
          (retry_args.exc.status == TOO_MANY_REQUESTS or
           retry_args.exc.status >= 500)):
        logging.debug(
            'Caught transient credential refresh error (%s), retrying',
            retry_args.exc)
    elif isinstance(retry_args.exc, exceptions.RequestError):
        logging.debug('Request returned no response, retrying')
    # API-level failures
    elif isinstance(retry_args.exc, exceptions.BadStatusCodeError):
        logging.debug('Response returned status %s, retrying',
                      retry_args.exc.status_code)
    elif isinstance(retry_args.exc, exceptions.RetryAfterError):
        logging.debug('Response returned a retry-after header, retrying')
        retry_after = retry_args.exc.retry_after
    else:
        raise retry_args.exc
    RebuildHttpConnections(retry_args.http)
    logging.debug('Retrying request to url %s after exception %s',
                  retry_args.http_request.url, retry_args.exc)
    time.sleep(
        retry_after or util.CalculateWaitForRetry(
            retry_args.num_retries, max_wait=retry_args.max_retry_wait))