示例#1
0
int 
cURLpp::CurlHandle::executeProgressFunctor(double dltotal, 
					   double dlnow, 
					   double ultotal, 
					   double ulnow)
{
  if(mProgressFunctor) {
    try {
      return (*mProgressFunctor)(dltotal, dlnow, ultotal, ulnow);
    }
    catch(cURLpp::CallbackExceptionBase *e) {
      setException(e);
    }
    catch(...) {
      setException(new CallbackException< cURLpp::UnknowException >(cURLpp::UnknowException()));
    }
  }
  
  return -1;
}
void c_AsyncFunctionWaitHandle::markAsFailed(CObjRef exception) {
  AsioSession* session = AsioSession::Get();
  if (UNLIKELY(session->hasOnAsyncFunctionFailCallback())) {
    session->onAsyncFunctionFail(this, exception);
  }

  setException(exception.get());

  m_continuation = nullptr;
  m_child = nullptr;
}
示例#3
0
int HTTPSession::write(const char* buffer, std::streamsize length)
{
	try
	{
		return _socket.sendBytes(buffer, (int) length);
	}
	catch (Poco::Exception& exc)
	{
		setException(exc);
		throw;
	}
}
示例#4
0
void ExceptionState::throwWebCLException(const ExceptionCode& ec, 
                                         const String& message) {
    ASSERT(ec);
    ASSERT(m_isolate);

    // SecurityError is thrown via ::throwSecurityError, and _careful_ consideration must be given to the data exposed to JavaScript via the 'sanitizedMessage'.
    ASSERT(ec != SecurityError);

    m_code = ec;
    String processedMessage = addExceptionContext(message);
    setException(V8ThrowException::createWebCLException(ec, processedMessage, m_creationContext, m_isolate));
}
示例#5
0
int HTTPSession::receive(char* buffer, int length)
{
	try
	{
		return _socket.receiveBytes(buffer, length);
	}
	catch (Poco::Exception& exc)
	{
		setException(exc);
		throw;
	}
}
示例#6
0
void VM::throwException(ExecState* exec, Exception* exception)
{
    if (Options::breakOnThrow()) {
        dataLog("In call frame ", RawPointer(exec), " for code block ", *exec->codeBlock(), "\n");
        CRASH();
    }

    ASSERT(exec == topCallFrame || exec == exec->lexicalGlobalObject()->globalExec() || exec == exec->vmEntryGlobalObject()->globalExec());

    interpreter->notifyDebuggerOfExceptionToBeThrown(exec, exception);

    setException(exception);
}
示例#7
0
CURLcode CurlHandle::executeSslCtxFunctor(void* ssl_ctx) {
  if (!mSslFunctor) {
    setException(new CallbackException<curlpp::LogicError>(
        curlpp::LogicError("Null write functor")));
    return CURLE_ABORTED_BY_CALLBACK;
  }

  try {
    return mSslFunctor(ssl_ctx);
  }

  catch (curlpp::CallbackExceptionBase* e) {
    setException(e);
  }

  catch (...) {
    setException(new CallbackException<curlpp::UnknowException>(
        curlpp::UnknowException()));
  }

  return CURLE_ABORTED_BY_CALLBACK;
}
示例#8
0
size_t CurlHandle::executeReadFunctor(char* buffer, size_t size,
                                      size_t nitems) {
  if (!mReadFunctor) {
    setException(new CallbackException<curlpp::LogicError>(
        curlpp::LogicError("Null write functor")));
    return CURLE_ABORTED_BY_CALLBACK;
  }

  try {
    return mReadFunctor(buffer, size, nitems);
  }

  catch (curlpp::CallbackExceptionBase* e) {
    setException(e);
  }

  catch (...) {
    setException(new CallbackException<curlpp::UnknowException>(
        curlpp::UnknowException()));
  }

  return CURLE_ABORTED_BY_CALLBACK;
}
示例#9
0
int CurlHandle::executeDebugFunctor(curl_infotype info, char* buffer,
                                    size_t size) {
  if (!mDebugFunctor) {
    setException(new CallbackException<curlpp::LogicError>(
        curlpp::LogicError("Null write functor")));
    return CURLE_ABORTED_BY_CALLBACK;
  }

  try {
    return mDebugFunctor(info, buffer, size);
  }

  catch (curlpp::CallbackExceptionBase* e) {
    setException(e);
  }

  catch (...) {
    setException(new CallbackException<curlpp::UnknowException>(
        curlpp::UnknowException()));
  }

  return CURLE_ABORTED_BY_CALLBACK;
}
示例#10
0
int CurlHandle::executeProgressFunctor(double dltotal, double dlnow,
                                       double ultotal, double ulnow) {
  if (!mProgressFunctor) {
    setException(new CallbackException<curlpp::LogicError>(
        curlpp::LogicError("Null write functor")));
    return CURLE_ABORTED_BY_CALLBACK;
  }

  try {
    return mProgressFunctor(dltotal, dlnow, ultotal, ulnow);
  }

  catch (curlpp::CallbackExceptionBase* e) {
    setException(e);
  }

  catch (...) {
    setException(new CallbackException<curlpp::UnknowException>(
        curlpp::UnknowException()));
  }

  return CURLE_ABORTED_BY_CALLBACK;
}
示例#11
0
typename FunctorType::ResultType CurlHandle::execute(
    FunctorType functor, typename FunctorType::ParamList params) {
  if (!functor) {
    setException(new CallbackException<curlpp::LogicError>(
        curlpp::LogicError("Null functor")));
    return CURLE_ABORTED_BY_CALLBACK;
  }

  try {
    return functor(params);
  }

  catch (curlpp::CallbackExceptionBase* e) {
    setException(e);
  }

  catch (...) {
    setException(new CallbackException<curlpp::UnknowException>(
        curlpp::UnknowException()));
  }

  return CURLE_ABORTED_BY_CALLBACK;
}
示例#12
0
Kross::Api::Object::Ptr RubyScript::execute()
{
#ifdef KROSS_RUBY_SCRIPT_DEBUG
    krossdebug("RubyScript::execute()");
#endif
    if(d->m_compile == 0)
    {
        compile();
    }
#ifdef KROSS_RUBY_SCRIPT_DEBUG
    krossdebug("Start execution");
#endif
    selectScript();
    int result = ruby_exec();
    if (result != 0)
    {
#ifdef KROSS_RUBY_SCRIPT_DEBUG
        krossdebug("Execution has failed");
#endif
        if( TYPE( ruby_errinfo )  == T_DATA && RubyExtension::isOfExceptionType( ruby_errinfo ) )
        {
#ifdef KROSS_RUBY_SCRIPT_DEBUG
            krossdebug("Kross exception");
#endif
            setException( RubyExtension::convertToException( ruby_errinfo ) );
        } else {
            setException( new Kross::Api::Exception(QString("Failed to execute ruby code: %1").arg(STR2CSTR( rb_obj_as_string(ruby_errinfo) )), 0) ); // TODO: get the error
        }
    }

    unselectScript();
#ifdef KROSS_RUBY_SCRIPT_DEBUG
    krossdebug("Execution is finished");
#endif
    return 0;
}
示例#13
0
文件: excep.c 项目: OPSF/uClinux
void signalChainedExceptionClass(Class *exception, char *message, Object *cause) {
    Object *exp = allocObject(exception);
    Object *str = message == NULL ? NULL : Cstr2String(message);
    MethodBlock *init = lookupMethod(exception, SYMBOL(object_init),
                                                SYMBOL(_java_lang_String__V));
    if(exp && init) {
        executeMethod(exp, init, str);

        if(cause && !exceptionOccurred()) {
            MethodBlock *mb = lookupMethod(exception, SYMBOL(initCause),
                                           SYMBOL(_java_lang_Throwable__java_lang_Throwable));
            if(mb)
                executeMethod(exp, mb, cause);
        }
        setException(exp);
    }
}
void c_GenArrayWaitHandle::onUnblocked() {
  for (;
       m_iterPos != ArrayData::invalid_index;
       m_iterPos = m_deps->iter_advance(m_iterPos)) {

    TypedValue* current = m_deps->nvGetValueRef(m_iterPos);
    if (IS_NULL_TYPE(current->m_type)) {
      // {uninit,null} yields null
      tvWriteNull(current);
      continue;
    }

    assert(current->m_type == KindOfObject);
    assert(dynamic_cast<c_WaitHandle*>(current->m_data.pobj));
    auto child = static_cast<c_WaitHandle*>(current->m_data.pobj);

    if (child->isSucceeded()) {
      tvSetIgnoreRef(child->getResult(), current);
    } else if (child->isFailed()) {
      putException(m_exception, child->getException());
    } else {
      assert(dynamic_cast<c_WaitableWaitHandle*>(child));
      auto child_wh = static_cast<c_WaitableWaitHandle*>(child);

      try {
        blockOn(child_wh);
        return;
      } catch (const Object& cycle_exception) {
        putException(m_exception, cycle_exception.get());
      }
    }
  }

  if (m_exception.isNull()) {
    TypedValue result;
    result.m_type = KindOfArray;
    result.m_data.parr = m_deps.get();
    setResult(&result);
    m_deps = nullptr;
  } else {
    setException(m_exception.get());
    m_exception = nullptr;
    m_deps = nullptr;
  }
}
示例#15
0
void c_GenMapWaitHandle::onUnblocked() {
  for (;
       m_deps->iter_valid(m_iterPos);
       m_iterPos = m_deps->iter_next(m_iterPos)) {

    Cell* current = tvAssertCell(m_deps->iter_value(m_iterPos));
    assert(current->m_type == KindOfObject);
    assert(current->m_data.pobj->instanceof(c_WaitHandle::classof()));
    auto child = static_cast<c_WaitHandle*>(current->m_data.pobj);

    if (child->isSucceeded()) {
      cellSet(child->getResult(), *current);
    } else if (child->isFailed()) {
      putException(m_exception, child->getException());
    } else {
      assert(child->instanceof(c_WaitHandle::classof()));
      auto child_wh = static_cast<c_WaitableWaitHandle*>(child);

      try {
        if (isInContext()) {
          child_wh->enterContext(getContextIdx());
        }
        detectCycle(child_wh);
        blockOn(child_wh);
        return;
      } catch (const Object& cycle_exception) {
        putException(m_exception, cycle_exception.get());
      }
    }
  }

  if (m_exception.isNull()) {
    setResult(make_tv<KindOfObject>(m_deps.get()));
    m_deps = nullptr;
  } else {
    setException(m_exception.get());
    m_exception = nullptr;
    m_deps = nullptr;
  }
}
void c_ExternalThreadEventWaitHandle::process() {
  assert(getState() == STATE_WAITING);

  if (isInContext()) {
    getContext()->unregisterExternalThreadEvent(m_index);
  }

  try {
    TypedValue result;
    m_event->unserialize(&result);
    assert(tvIsPlausible(&result));
    setResult(&result);
    tvRefcountedDecRefCell(&result);
  } catch (const Object& exception) {
    setException(exception.get());
  }

  // event is processed, destroy it, unregister sweepable and decref ownership
  m_event->release();
  m_event = nullptr;
  m_privData = nullptr;
  unregister();
  decRefObj(this);
}
示例#17
0
void Status::setServiceSpecificError(int32_t errorCode, const String8& message) {
    setException(EX_SERVICE_SPECIFIC, message);
    mErrorCode = errorCode;
}