We want to raise the exception only at ready time
4513
private static InputStream getInputStreamFromFilename(String filename) {
        try {
            return new FileInputStream(filename);
        } catch (FileNotFoundException e) {
            log.debug("Error initializing RdfStreamReader, file '{}' not found", filename);
            // do not handle exception at construction time
            return null;
        }
    }
492475
@Override
  public boolean ready() throws IOException {
    try {
      return in.ready();
    } catch (IOException e) {
      handleIOException(e);
      return false;
    }
  }
1245974
def send_exception(self):
        """"""
        self.compiler.reset()

        exc = traceback.format_exc()
        self.writer.write(exc.encode('utf8'))

        yield from self.writer.drain()
780881
def rewrite_exception(old_name, new_name):
    """"""
    try:
        yield
    except Exception as e:
        msg = e.args[0]
        msg = msg.replace(old_name, new_name)
        args = (msg,)
        if len(e.args) > 1:
            args = args + e.args[1:]
        e.args = args
        raise
515377
def request_error!(exception)
      case exception
      when Net::OpenTimeout
        raise Down::TimeoutError, "timed out waiting for connection to open"
      when Net::ReadTimeout
        raise Down::TimeoutError, "timed out while reading data"
      when EOFError, IOError, SocketError, SystemCallError
        raise Down::ConnectionError, exception.message
      when OpenSSL::SSL::SSLError
        raise Down::SSLError, exception.message
      else
        raise exception
      end
    end
989485
private void setReady() throws SINotPossibleInCurrentConfigurationException
    {
        // If we're not transacted no messages are recoverable
        Reliability unrecoverable = Reliability.ASSURED_PERSISTENT;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "setReady", this);

        // If the consumer is transacted inform the CD what
        // recoverability is required.
        if (_transacted)
            unrecoverable = _unrecoverableOptions;

        //set the ready state
        _ready = true;

        if (_keyGroup != null)
            _keyGroup.groupReady();

        //and inform the consumerDispatcher that we are ready
        _consumerKey.ready(unrecoverable);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "setReady");
    }
894494
def check(self):
        
        try:
            self.join(timeout=0)
        except Exception as e:
            logger.exception(e)
            raise
814706
function _readyState(o, c) {
        if (o.c.readyState === 4) {
            if (c.timeout) {
                _clearTimeout(o.id);
            }

            w.setTimeout(
                function() {
                    _ioComplete(o, c);
                    _handleResponse(o, c);
                }, 0);
        }
    }
245154
protected function exceptionIfFetchedAlready()
    {
        if ($this->fetched) {
            throw new RuntimeException(
                Message::get(Message::DB_FETCHED_ALREADY),
                Message::DB_FETCHED_ALREADY
            );
        }
    }
649689
def exception(self, timeout=None):
        
        if not self._done.wait(timeout):
            raise Timeout('timeout waiting for future')
        if self._state == self.S_EXCEPTION:
            return self._result
827928
def raiseError(cls, message):
        
        error_message = "[error] %s" % message
        if cls.__raise_exception__:
            raise Exception(error_message)

        cls.colorprint(error_message, Fore.RED)
        sys.exit(1)
1284947
def assert_or_raise(stmt: bool, exception: Exception,
                    *exception_args, **exception_kwargs) -> None:
  
  if not stmt:
    raise exception(*exception_args, **exception_kwargs)
1066643
def raise_(tp, value=None, tb=None):
    
    if value is not None and isinstance(tp, Exception):
        raise TypeError("instance exception may not have a separate value")
    if value is not None:
        exc = tp(value)
    else:
        exc = tp
    if exc.__traceback__ is not tb:
        raise exc.with_traceback(tb)
    raise exc
90253
def _exception_free_callback(self, callback, *args, **kwargs):
        
        try:
            return callback(*args, **kwargs)
        except Exception:
            self._logger.exception("An exception occurred while calling a hook! ",exc_info=True)
            return None
490117
def remove_on_exception(dirname, remove=True):
    """"""
    os.makedirs(dirname)
    try:
        yield
    except:
        if remove:
            shutil.rmtree(dirname, ignore_errors=True)
        raise
880589
def async_raise(self, exc_type):
    """"""
    # Should only be called on a started thread, so raise otherwise.
    assert self.ident is not None, 'Only started threads have thread identifier'

    # If the thread has died we don't want to raise an exception so log.
    if not self.is_alive():
      _LOG.debug('Not raising %s because thread %s (%s) is not alive',
                 exc_type, self.name, self.ident)
      return

    result = ctypes.pythonapi.PyThreadState_SetAsyncExc(
        ctypes.c_long(self.ident), ctypes.py_object(exc_type))
    if result == 0 and self.is_alive():
      # Don't raise an exception an error unnecessarily if the thread is dead.
      raise ValueError('Thread ID was invalid.', self.ident)
    elif result > 1:
      # Something bad happened, call with a NULL exception to undo.
      ctypes.pythonapi.PyThreadState_SetAsyncExc(self.ident, None)
      raise RuntimeError('Error: PyThreadState_SetAsyncExc %s %s (%s) %s' % (
          exc_type, self.name, self.ident, result))
959724
def future_raise(self, tp, value=None, tb=None):
        """"""
        if value is not None and isinstance(tp, Exception):
            raise TypeError("instance exception may not have a separate value")
        if value is not None:
            exc = tp(value)
        else:
            exc = tp
        if exc.__traceback__ is not tb:
            raise exc.with_traceback(tb)
        raise exc