• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ErrorToException函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ErrorToException

MojErr UpSyncSentEmailsCommand::GetSentFolderNameResponse(MojObject& response, MojErr err)
{
	try {
			ErrorToException(err);

			MojObject folderObj;
			DatabaseAdapter::GetOneResult(response, folderObj);

			MojString sentFolderName;
			err = folderObj.getRequired(ImapFolderAdapter::SERVER_FOLDER_NAME, sentFolderName);
			ErrorToException(err);

			m_sentFolderName.assign(sentFolderName);

			GetSentEmails();

		} CATCH_AS_FAILURE

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


示例17: ErrorToException

void SmtpAccountEnableCommand::CreateSmtpConfigWatch()
{
	SmtpActivityFactory factory;
	ActivityBuilder ab;

	factory.BuildSmtpConfigWatch(ab, m_client.GetAccountId(), m_accountRev);

	// Create payload
	MojObject payload;
	MojErr err;

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

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


示例18: ErrorToException

void SaveEmailCommand::WriteToFileCache(MojObject &part, const MojString &pathName)
{
	MojErr err;
	MojString content;
	err = part.getRequired("content", content);
	ErrorToException(err);
	
	// FIXME: make this async
	FILE *fp = fopen(pathName.data(), "w");
	if(fp) {
		fwrite(content.data(), sizeof(MojChar), content.length(), fp);
		fclose(fp);
	} else {
		throw MailException("error opening file cache path", __FILE__, __LINE__);
	}
	
	// Cancel subscription to signal that we're done writing
	m_fileCacheInsertedSlot.cancel();

	MojString type;
	err = part.getRequired(EmailSchema::Part::TYPE, type);
	ErrorToException(err);

	if (type == EmailSchema::Part::Type::BODY) {
		std::string previewText = PreviewTextGenerator::GeneratePreviewText(content.data(), MAX_SUMMARY_LENGTH, true);
		err = m_email.putString(EmailSchema::SUMMARY, previewText.c_str());
		ErrorToException(err);
	}

	// Delete content field so it doesn't get written to the database
	bool wasDeleted;
	part.del("content", wasDeleted);
	
	// Next step
	if(m_partsIt == m_partsArray.arrayEnd())
		PersistToDatabase(); // done
	else
		CreateNextCacheObject(); // more parts remaining
	
	return;
}
开发者ID:Garfonso,项目名称:app-services,代码行数:41,代码来源:SaveEmailCommand.cpp


示例19: AsJsonString

void SmtpActivityFactory::BuildSmtpConfigWatch(ActivityBuilder& ab, const MojObject& accountId, MojInt64 rev)
{
	MojErr err;

	MojString name;
	err = name.format(ACCOUNT_WATCH_ACTIVITY_FMT, AsJsonString(accountId).c_str());
	ErrorToException(err);

	// description of watch
	MojString desc;
	err = desc.format("Watches SMTP config on account %s", AsJsonString(accountId).c_str());
	ErrorToException(err);

	// activity to setup watch
	ab.SetName(name);
	ab.SetDescription(desc.data());
	ab.SetPersist(true);
	ab.SetExplicit(true);
	ab.SetRequiresInternet(false); // trigger even if we don't have a network connection
	ab.SetImmediate(true, ActivityBuilder::PRIORITY_LOW);

	// setup trigger
	// NOTE: how to trigger only on SMTP config change?
	MojDbQuery trigger;
	err = trigger.from("com.palm.mail.account:1");
	ErrorToException(err);
	err = trigger.where("accountId", MojDbQuery::OpEq, accountId);
	ErrorToException(err);

	if (rev > 0) {
		trigger.where("_revSmtp", MojDbQuery::OpGreaterThan, rev);
	}
	ab.SetDatabaseWatchTrigger(trigger);

	MojObject params;
	err = params.put("accountId", accountId);
	ErrorToException(err);

	ab.SetCallback(ACCOUNT_UPDATED_BUS_METHOD, params);
	ab.SetMetadata(params);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:41,代码来源:SmtpActivityFactory.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Error_Handler函数代码示例发布时间:2022-05-30
下一篇:
C++ ErrorPrint函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap