当前位置: 首页>>代码示例>>C++>>正文


C++ ErrorToException函数代码示例

本文整理汇总了C++中ErrorToException函数的典型用法代码示例。如果您正苦于以下问题:C++ ErrorToException函数的具体用法?C++ ErrorToException怎么用?C++ ErrorToException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ErrorToException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ErrorToException

void MojoDatabase::ReserveIds(Signal::SlotRef slot, int count)
{
	if (count > RESERVE_ID_MAX)
		count = RESERVE_ID_MAX;
	MojErr err = m_dbClient.reserveIds(slot, count);
	ErrorToException(err);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:7,代码来源:MojoDatabase.cpp

示例2: CommandTraceFunction

void MovePopEmailsCommand::RunImpl()
{
	CommandTraceFunction();
	try {

		if (!m_client.GetAccount().get()) {
			MojString err;
			err.format("Account is not loaded for '%s'", AsJsonString(
					m_client.GetAccountId()).c_str());
			throw MailException(err.data(), __FILE__, __LINE__);
		}

		MojErr err = m_payload.getRequired("accountId", m_accountId);
		ErrorToException(err);

		m_activity = ActivityParser::GetActivityFromPayload(m_payload);

		if (m_activity.get()) {
			m_activity->SetSlots(m_activityUpdateSlot, m_activityErrorSlot);
			m_activity->Adopt(m_client);
			return;
		} else {
			GetEmailsToMove();
		}
	} catch (const std::exception& ex) {
		m_msg->replyError(MojErrInternal, ex.what());
		Failure(ex);
	} catch (...) {
		MailException ex("unknown exception", __FILE__, __LINE__);
		m_msg->replyError(MojErrInternal, ex.what());
		Failure(ex);
	}
}
开发者ID:Garfonso,项目名称:app-services,代码行数:33,代码来源:MovePopEmailsCommand.cpp

示例3: ErrorToException

void MockRequest::ReplySuccess(MojObject response)
{
	MojErr err = response.put("returnValue", true);
	ErrorToException(err);

	Reply(response, MojErrNone);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:7,代码来源:MockRemoteService.cpp

示例4: ErrorToException

MojErr MovePopEmailsCommand::EmailsMovedResponse(MojObject& response, MojErr err)
{
	try {
		ErrorToException(err);

		ActivityBuilder ab;
		m_client.GetActivityBuilderFactory()->BuildMoveEmailsWatch(ab);
		m_activity->UpdateAndComplete(m_client, ab.GetActivityObject());

		m_msg->replySuccess();

		if (m_inboxEmailsMoved.size() > 0) {
			// add the list of UIDs into UidCache
			GetUidCache();
		} else {
			Complete();
		}
	} catch (const std::exception& ex) {
		m_msg->replyError(MojErrInternal, ex.what());
		Failure(ex);
	} catch (...) {
		m_msg->replyError(MojErrInternal);
		Failure(MailException("unknown exception", __FILE__, __LINE__));
	}

	return MojErrNone;
}
开发者ID:Garfonso,项目名称:app-services,代码行数:27,代码来源:MovePopEmailsCommand.cpp

示例5: AsJsonString

void SyncAccountCommand::RunImpl()
{
	try {
		if (!m_client.GetAccount().get()) {
			MojString err;
			err.format("Account is not loaded for '%s'", AsJsonString(
					m_client.GetAccountId()).c_str());
			throw MailException(err.data(), __FILE__, __LINE__);
		}

		m_account = m_client.GetAccount();
		if(m_account->HasPassword()) {
			m_accountId = m_account->GetAccountId();
			MojObject inboxFolderId = m_account->GetInboxFolderId();

			MojLogInfo(m_log, "Creating command to sync inbox emails");

			MojErr err = m_payload.put(EmailSchema::FOLDER_ID, inboxFolderId);
			ErrorToException(err);

			m_client.SyncFolder(m_payload);
		} else {
			MojLogInfo(m_log, "No password!  Sync aborted!");
		}

		Complete();
	} catch (const std::exception& ex) {
		Failure(ex);
	} catch (...) {
		Failure(MailException("Unknown exception", __FILE__, __LINE__));
	}
}
开发者ID:hatsada1,项目名称:app-services,代码行数:32,代码来源:SyncAccountCommand.cpp

示例6: ErrorToException

MojRefCountedPtr<MojServiceRequest> BusClient::CreateRequest()
{
	MojRefCountedPtr<MojServiceRequest> req;
	MojErr err = m_service->createRequest(req);
	ErrorToException(err);
	return req;
}
开发者ID:hatsada1,项目名称:app-services,代码行数:7,代码来源:BusClient.cpp

示例7: MojLogTrace

MojErr AuthYahooCommand::GetYahooCookiesSlot(MojObject& response, MojErr err)
{
	MojLogTrace(m_log);
	try {
		ResponseToException(response, err);

		MojObject object;
		err = response.getRequired("tCookie", m_tCookie);
		ErrorToException(err);
	
		err = response.getRequired("yCookie", m_yCookie);
		ErrorToException(err);
	
	} catch (const std::exception& e) {
		MojLogInfo(m_log, "Failed to retrieve Yahoo cookies, failing login: %s", e.what());
		
		// FIXME: We should possibly try to decode and pass along a specific error
		
		SmtpSession::SmtpError error;
		error.errorCode = MailError::ACCOUNT_UNAVAILABLE;
		error.errorOnAccount = true;
		error.internalError = std::string("Unable to retrieve yahoo cookies: ") + e.what();
		m_session.AuthYahooFailure(error);
		Complete();
		
		return MojErrNone;
	} catch (...) {
		MojLogInfo(m_log, "Failed to retrieve Yahoo cookies, failing login: unknown exception");

		// FIXME: We should possibly try to decode and pass along a specific error

		SmtpSession::SmtpError error;
		error.errorCode = MailError::ACCOUNT_UNAVAILABLE;
		error.errorOnAccount = true;
		error.internalError = "Unable to retrieve yahoo cookies: unknown exception";
		m_session.AuthYahooFailure(error);
		Complete();

		return MojErrNone;
	}

	m_state = State_SendingYCookie;
	WriteCommand();
	
	return MojErrNone;
}
开发者ID:Garfonso,项目名称:app-services,代码行数:46,代码来源:AuthYahooCommand.cpp

示例8: CommandTraceFunction

void AccountFinderCommand::GetAccount()
{
	CommandTraceFunction();

	try {
		MojObject params;
		MojErr err = params.put("accountId", m_accountId);
		ErrorToException(err);

		err = m_client.CreateRequest()->send(m_getAccountSlot, "com.palm.service.accounts","getAccountInfo", params);
		ErrorToException(err);
	} catch (const std::exception& ex) {
		Failure(ex);
	} catch (...) {
		Failure(MailException("unknown exception", __FILE__, __LINE__));
	}
}
开发者ID:Garfonso,项目名称:app-services,代码行数:17,代码来源:AccountFinderCommand.cpp

示例9: CreateRequest

void BusClient::SendRequest(MojServiceRequest::ReplySignal::SlotRef handler, const MojChar* service,
		const MojChar* method, const MojObject& payload, MojUInt32 numReplies)
{
	MojRefCountedPtr<MojServiceRequest> req = CreateRequest();

	MojErr err = req->send(handler, service, method, payload, numReplies);
	ErrorToException(err);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:8,代码来源:BusClient.cpp

示例10: AsJsonString

MojString ImapActivityFactory::FormatName(const char* name, const MojObject& accountId, const MojObject& folderId)
{
	MojString formattedName;
	MojErr err = formattedName.format("%s/accountId=%s/folderId=%s",
			name, AsJsonString(accountId).c_str(), AsJsonString(folderId).c_str());
	ErrorToException(err);
	return formattedName;
}
开发者ID:Garfonso,项目名称:app-services,代码行数:8,代码来源:ImapActivityFactory.cpp

示例11: CommandTraceFunction

MojErr PopAccountUpdateCommand::GetPasswordResponse(MojObject& response, MojErr err)
{
	CommandTraceFunction();

	try {
		// check the result first
		ErrorToException(err);

		MojObject credentials;
		err = response.getRequired("credentials", credentials);
		ErrorToException(err);

		MojString password;
		err = credentials.getRequired("password", password);
		ErrorToException(err);

		boost::shared_ptr<PopAccount> newPopAccount(new PopAccount());
		PopAccountAdapter::GetPopAccountFromTransportObject(m_transportObj, *(newPopAccount.get()));
		newPopAccount->SetPassword(password.data());

		boost::shared_ptr<PopAccount> oldPopAccount = m_client.GetAccount();

		if (!oldPopAccount.get()) {
			m_callSyncFolderOnClient = true;
		} else if (newPopAccount->GetPort() != oldPopAccount->GetPort() ||
			newPopAccount->GetEncryption() != oldPopAccount->GetEncryption() ||
			newPopAccount->GetUsername() != oldPopAccount->GetUsername() ||
			newPopAccount->GetSyncFrequencyMins() != oldPopAccount->GetSyncWindowDays() ||
			newPopAccount->GetHostName() != oldPopAccount->GetHostName()) {
			m_callSyncFolderOnClient = true;
		}
		
		// Should be initial sync if the old account does not exist 
		// or the old account is in initial sync state.
		newPopAccount->SetInitialSync(!oldPopAccount.get() || oldPopAccount->IsInitialSync());
		m_client.SetAccount(newPopAccount);
		UpdateAccountWatchActivity();
	} catch (const std::exception& ex) {
		Failure(ex);
	} catch (...) {
		Failure(MailException("unknown exception", __FILE__, __LINE__));
	}

	return MojErrNone;
}
开发者ID:Garfonso,项目名称:app-services,代码行数:45,代码来源:PopAccountUpdateCommand.cpp

示例12: ErrorToException

void MojoDatabase::UpdateEmailParts(Signal::SlotRef slot, const MojObject& emailId, const MojObject& parts, bool autoDownload)
{
	MojObject email;
	MojErr err = email.put(PopEmailAdapter::ID, emailId);
	ErrorToException(err);

	err = email.put(EmailSchema::PARTS, parts);
	ErrorToException(err);

	if ((!parts.undefined() && !parts.null() && parts.size() > 0) || !autoDownload) {
		err = email.put(PopEmailAdapter::DOWNLOADED, true);
		ErrorToException(err);
	}

	MojLogDebug(PopClient::s_log, "Updating email '%s' with parts: '%s'", AsJsonString(emailId).c_str(), AsJsonString(parts).c_str());
	err = m_dbClient.merge(slot, email);
	ErrorToException(err);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:18,代码来源:MojoDatabase.cpp

示例13: ErrorToException

void PopAccountUpdateCommand::GetPassword()
{
	try {
		MojObject params;
		MojErr err = params.put("accountId", m_accountId);
		ErrorToException(err);

		err = params.putString("name", "common");
		ErrorToException(err);

		err = m_client.CreateRequest()->send(m_getPasswordSlot, "com.palm.service.accounts","readCredentials", params);
		ErrorToException(err);
	} catch (const std::exception& ex) {
		Failure(ex);
	} catch (...) {
		Failure(MailException("unknown exception", __FILE__, __LINE__));
	}
}
开发者ID:Garfonso,项目名称:app-services,代码行数:18,代码来源:PopAccountUpdateCommand.cpp

示例14: ErrorToException

void FileCacheClient::ExpireCacheObject(ReplySignal::SlotRef slot, const char* pathName)
{
    MojErr err;
    MojObject payload;

    err = payload.putString("pathName", pathName);
    ErrorToException(err);

    m_busClient.SendRequest(slot, FILECACHE_SERVICE, "ExpireCacheObject", payload);
}
开发者ID:kasimling,项目名称:app-services,代码行数:10,代码来源:FileCacheClient.cpp

示例15: CommandTraceFunction

void ScheduleRetryCommand::ScheduleRetry()
{
	CommandTraceFunction();

	ImapActivityFactory factory;
	ActivityBuilder ab;

	// Get current retry interval from account
	EmailAccount::RetryStatus retryStatus = m_client.GetAccount().GetRetry();

	int interval = retryStatus.GetInterval();

	if(interval < INITIAL_RETRY_SECONDS) {
		interval = INITIAL_RETRY_SECONDS;
	} else if(interval < SECOND_RETRY_SECONDS) {
		interval = SECOND_RETRY_SECONDS;
	} else if(interval >= MAX_RETRY_SECONDS) {
		interval = MAX_RETRY_SECONDS;
	} else {
		// TODO: only update this on actual retry?
		interval *= RETRY_MULTIPLIER;
	}

	// Update account just in case it wasn't within the limit
	retryStatus.SetInterval(interval);
	retryStatus.SetCount(retryStatus.GetCount() + 1);
	m_client.GetAccount().SetRetry(retryStatus);

	factory.BuildSyncRetry(ab, m_client.GetAccountId(), m_folderId, interval, m_reason);

	MojErr err;
	MojObject payload;
	err = payload.put("activity", ab.GetActivityObject());
	ErrorToException(err);
	err = payload.put("start", true);
	ErrorToException(err);
	err = payload.put("replace", true);

	MojLogInfo(m_log, "scheduling retry in %.1f minutes for account %s", float(interval) / 60, m_client.GetAccountIdString().c_str());

	m_client.SendRequest(m_scheduleRetrySlot, "com.palm.activitymanager", "create", payload);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:42,代码来源:ScheduleRetryCommand.cpp


注:本文中的ErrorToException函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。