本文整理汇总了C++中HandleException函数的典型用法代码示例。如果您正苦于以下问题:C++ HandleException函数的具体用法?C++ HandleException怎么用?C++ HandleException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HandleException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillData
void FillData(DataFillerParams* aParams)
{
JELOG2(ESensor);
JNIEnv* jniEnv = (JNIEnv*)aParams->iJniEnv;
jobjectArray destData = (jobjectArray)aParams->iDataObjects;
// Assign data
for (int i = 0; i < aParams->iDataCount; i++)
{
jobject data = jniEnv->GetObjectArrayElement(destData, i);
jclass dataClass = jniEnv->GetObjectClass(data);
if (aParams->iDatas[ i ]->iIntValues)
{
jfieldID field = jniEnv->GetFieldID(dataClass, "iIntValues", "[I");
jintArray intValues = jniEnv->NewIntArray(aParams->iDatas[ i ]->iNumOfValues);
jniEnv->SetIntArrayRegion(intValues, 0, aParams->iDatas[ i ]->iNumOfValues,
aParams->iDatas[ i ]->iIntValues);
jniEnv->SetObjectField(data, field, intValues);
jniEnv->DeleteLocalRef(intValues);
HandleException(*jniEnv);
}
else if (aParams->iDatas[ i ]->iDoubleValues)
{
jfieldID field = jniEnv->GetFieldID(dataClass, "iDoubleValues", "[D");
jdoubleArray doubleValues = jniEnv->NewDoubleArray(aParams->iDatas[ i ]->iNumOfValues);
jniEnv->SetDoubleArrayRegion(doubleValues, 0, aParams->iDatas[ i ]->iNumOfValues,
aParams->iDatas[ i ]->iDoubleValues);
jniEnv->SetObjectField(data, field, doubleValues);
jniEnv->DeleteLocalRef(doubleValues);
HandleException(*jniEnv);
}
if (aParams->iDatas[ i ]->iTimeStampsIncluded)
{
jfieldID field = jniEnv->GetFieldID(dataClass, "iTimestamps", "[J");
jlongArray timestamps = jniEnv->NewLongArray(aParams->iDatas[ i ]->iNumOfValues);
jniEnv->SetLongArrayRegion(timestamps, 0, aParams->iDatas[ i ]->iNumOfValues,
reinterpret_cast<jlong*>(aParams->iDatas[ i ]->iTimeStamps));
jniEnv->SetObjectField(data, field, timestamps);
jniEnv->DeleteLocalRef(timestamps);
HandleException(*jniEnv);
}
if (aParams->iDatas[ i ]->iValiditiesIncluded)
{
jfieldID field = jniEnv->GetFieldID(dataClass, "iValidities", "[Z");
jbooleanArray validities = jniEnv->NewBooleanArray(aParams->iDatas[ i ]->iNumOfValues);
jniEnv->SetBooleanArrayRegion(validities, 0, aParams->iDatas[ i ]->iNumOfValues,
reinterpret_cast<jboolean*>(aParams->iDatas[ i ]->iValidities));
jniEnv->SetObjectField(data, field, validities);
jniEnv->DeleteLocalRef(validities);
HandleException(*jniEnv);
}
}
jobject peer = (jobject) aParams->iJavaPeer;
jclass cls = jniEnv->GetObjectClass(peer);
jmethodID mid = jniEnv->GetMethodID(cls, "dataReceived", "([Ljavax/microedition/sensor/Data;Z)V");
jniEnv->CallVoidMethod(peer, mid, destData, aParams->iIsDataLost);
// Handle possible exception in callback
HandleException(*jniEnv);
}
示例2: MojLogInfo
MojErr SmtpSyncOutboxCommand::NetworkActivityUpdated(Activity * activity, Activity::EventType)
{
try {
MojLogInfo(m_log, "SyncOutboxcommand has updated network activity");
MojRefCountedPtr<Activity> actPtr = activity;
MojLogInfo(m_log, "Activity->info is %s", AsJsonString(actPtr->GetInfo()).c_str());
bool p = m_networkStatus->ParseActivity(actPtr);
MojLogInfo(m_log, "p=%d, known=%d, connected=%d",
p, m_networkStatus->IsKnown(), m_networkStatus->IsConnected());
if (m_networkStatus->IsKnown()) {
m_networkActivityUpdatedSlot.cancel();
m_networkActivityErrorSlot.cancel();
// Go on
CheckNetworkConnectivity();
}
} catch (std::exception & e) {
HandleException(e, __func__, true);
} catch (...) {
HandleException(__func__, true);
}
return MojErrNone;
}
示例3: while
int Window::MessageLoop()
{
MSG msg;
while(GetMessage(&msg, 0, 0, 0)) {
try {
if (pretranslate_msg(&msg))
continue;
if (dispatch_dialog_msg(&msg))
continue;
TranslateMessage(&msg);
try {
DispatchMessage(&msg);
} catch(COMException& e) {
HandleException(e, 0);
}
} catch(COMException& e) {
HandleException(e, 0);
}
}
return msg.wParam;
}
示例4: WINDOW_CREATOR
int PropertySheetDialog::DoModal(int start_page)
{
PROPSHEETHEADER::ppsp = (LPCPROPSHEETPAGE) &_pages[0];
PROPSHEETHEADER::nPages = _pages.size();
PROPSHEETHEADER::nStartPage = start_page;
/*
Window* pwnd = Window::create_property_sheet(this, WINDOW_CREATOR(PropertySheetDlg), NULL);
if (!pwnd)
return -1;
HWND hwndPropSheet = *pwnd;
*/
int ret = PropertySheet(this);
if (ret == -1)
return -1;
HWND hwndPropSheet = (HWND) ret;
HWND hwndparent = GetParent(hwndPropSheet);
if (hwndparent)
EnableWindow(hwndparent, FALSE);
ret = 0;
MSG msg;
while(GetMessage(&msg, 0, 0, 0)) {
try {
if (Window::pretranslate_msg(&msg))
continue;
if (PropSheet_IsDialogMessage(hwndPropSheet, &msg))
continue;
if (Window::dispatch_dialog_msg(&msg))
continue;
TranslateMessage(&msg);
try {
DispatchMessage(&msg);
} catch(COMException& e) {
HandleException(e, 0);
}
if (!PropSheet_GetCurrentPageHwnd(hwndPropSheet)) {
ret = PropSheet_GetResult(hwndPropSheet);
break;
}
} catch(COMException& e) {
HandleException(e, 0);
}
}
if (hwndparent)
EnableWindow(hwndparent, TRUE);
DestroyWindow(hwndPropSheet);
return ret;
}
示例5: ResponseToException
MojErr SmtpSyncOutboxCommand::GetOutboxEmailsResponse(MojObject &response, MojErr err)
{
try {
ResponseToException(response, err);
try {
ErrorToException(err);
BOOST_FOREACH(const MojObject& email, DatabaseAdapter::GetResultsIterators(response)) {
m_emailsToSend.push_back(email);
}
if(DatabaseAdapter::GetNextPage(response, m_outboxPage)) {
// Get more emails
GetSomeOutboxEmails();
} else {
MojLogInfo(m_log, "Found %d emails in outbox", m_emailsToSend.size());
m_emailIt = m_emailsToSend.begin();
m_didSomething = false;
SendNextEmail();
}
} catch(std::exception& e) {
HandleException(e, __func__);
} catch(...) {
HandleException(__func__);
}
} catch (std::exception & e) {
示例6: catch
/**
* Send flow
* - Get folder ID from account, if not provided
* - request list of mails that might need to be sent
* - for any mail that needs to be sent, enqueue a send mail command
* - if a send mail command has an error, mark account as needing a retry after a timeout, and stop mail sync.
* - loop on list of mails. At end of list, refetch list if we made any changes.
*
*
* - Error processing: mark account as needing a try after a timeoutAdopt activity from trigger OR create activity (manual sync)
* - Send emails
* - Create new watch activity
* - End old activity
*/
void SmtpSyncOutboxCommand::RunImpl()
{
try {
m_client.GetTempDatabaseInterface().ClearSyncStatus(m_clearSyncStatusSlot, m_accountId, m_folderId);
} catch (std::exception & e) {
HandleException(e, __func__);
} catch (...) {
HandleException(__func__);
}
}
示例7: CommandTraceFunction
void SmtpSyncOutboxCommand::GetOutboxEmails()
{
CommandTraceFunction();
try {
m_outboxPage.clear();
m_emailsToSend.clear();
GetSomeOutboxEmails();
} catch (std::exception & e) {
HandleException(e, __func__);
} catch (...) {
HandleException(__func__);
}
}
示例8: HijackCommandLine
HRESULT HijackCommandLine()
{
//SynchronizeThread(g_pFileCrypt->m_CryptSync);
HRESULT hr = E_FAIL;
__try
{
if (g_pGetCommandLine == NULL)
{
hr = mz_DetourFn(GetModuleHandle("kernel32.dll"), "GetCommandLineA", (VOID*)FGetCommandLine, (VOID**)&g_pGetCommandLine);
}
/*
if (g_pRealReadFile == NULL)
{
hr = mz_DetourFn(GetModuleHandle("kernel32.dll"), "ReadFile", (VOID*)FReadFile, (VOID**)&g_pRealReadFile);
if (SUCCEEDED(hr))
{
hr = mz_DetourFn(GetModuleHandle("kernel32.dll"), "CreateFileA", (VOID*)FCreateFile, (VOID**)&g_pRealCreateFile);
}
}
*/
} __except(HandleException("Detour_UnhijackAll()", GetExceptionCode())){}
return hr;
}
示例9: wait
/**
* @param uNotifyCode - notification code if the message is from a control. If the message is from an accelerator, this value is 1. If the message is from a menu, this value is zero.
* @param nID - specifies the identifier of the menu item, control, or accelerator.
* @param hWndCtl - handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL.
*/
void CExpressModeDlg::OnCalculate(UINT /*uNotifyCode*/, int /*nID*/, HWND /*hWndCtl*/)
{
try
{
CString strLogFile;
m_txtLogFile.GetWindowText(strLogFile);
if (GetFileAttributes(strLogFile) == INVALID_FILE_ATTRIBUTES)
{
MsgTip::ShowMessage(m_txtLogFile, IDS_INVALIDLOGFILE);
return;
}
CString strMapPdbFolder;
m_txtMapPdbFolder.GetWindowText(strMapPdbFolder);
if (GetFileAttributes(strMapPdbFolder) == INVALID_FILE_ATTRIBUTES)
{
MsgTip::ShowMessage(m_txtMapPdbFolder, IDS_INVALIDMAPPDBFOLDER);
return;
}
CWaitDialog wait(m_hWnd);
LoadXMLDocument(strLogFile);
SetErrorReasonText();
FillStackTraceList();
}
catch (std::exception& error)
{
HandleException(error);
}
}
示例10: LNote
void TNotesResource1::Get(TEndpointContext* AContext, TEndpointRequest* ARequest,
TEndpointResponse* AResponse)
{
String LTitle = "";
std::auto_ptr<TNote> LNote(new TNote());
std::vector<TNote*> * lNotes = NULL;
TJSONArray * lJson = NULL;
try {
this->CheckNotesManager(AContext);
if(ARequest->Params->TryGetValue("title", LTitle)) {
// Find a note with a particular title
if(FNotesStorage->FindNote(LTitle, LNote.get())) {
lNotes = new std::vector<TNote*>();
lNotes->push_back(LNote.get());
}
else {
lNotes = NULL;
}
}
else {
lNotes = FNotesStorage->GetNotes();
}
lJson = TNoteJSON::NotesToJSON(lNotes);
AResponse->Body->SetValue(lJson, true);
}
catch(...) {
FreeAndNil(lJson);
HandleException();
}
}
示例11: GCC_ASSERT
void NetSocket::VHandleOutput() {
int fSent = 0;
do {
GCC_ASSERT(!m_OutList.empty());
PacketList::iterator i = m_OutList.begin();
std::shared_ptr<IPacket> pkt = *i;
const char* buf = pkt->VGetData();
int len = static_cast<int>(pkt->VGetSize());
int rc = send(m_sock, buf + m_sendOfs, len - m_sendOfs, 0);
if (rc > 0) {
g_pSocketManager->AddToOutbound(rc);
m_sendOfs += rc;
fSent = 1;
} else if (WSAGetLastError() != WSAEWOULDBLOCK) {
HandleException();
fSent = 0;
} else {
fSent = 0;
}
if (m_sendOfs == pkt->VGetSize()) {
m_OutList.pop_front();
m_sendOfs = 0;
}
} while (fSent && !m_OutList.empty());
}
示例12: MojLogInfo
void SmtpSendMailCommand::CalculateEmailSize()
{
try {
MojLogInfo(m_log, "calculating email size");
m_counter.reset( new CounterOutputStream() );
// Wrap the mail writer in a CRLF fixer stream, which ensures that the stream ends with
// CRLF, so we can safely write out a DOT to end the body, without the risk that it'll end
// up on the end of a body line. We're doing that here, so the counter will include those
// octets.
m_crlfTerminator.reset( new CRLFTerminatedOutputStream(m_counter));
m_emailWriter.reset( new AsyncEmailWriter(m_email) );
m_emailWriter->SetOutputStream(m_crlfTerminator );
m_emailWriter->SetBccIncluded(false); // bcc should only appear in the RCPT list
m_emailWriter->SetPartList(m_email.GetPartList());
m_emailWriter->WriteEmail(m_calculateDoneSlot);
} catch (const std::exception& e) {
HandleException(e, __func__, __FILE__, __LINE__);
} catch (...) {
HandleUnknownException();
}
}
示例13: explorer_main
int explorer_main(HINSTANCE hInstance, LPTSTR lpCmdLine, int cmdShow)
{
CONTEXT("explorer_main");
// initialize Common Controls library
CommonControlInit usingCmnCtrl;
try {
InitInstance(hInstance);
} catch(COMException& e) {
HandleException(e, GetDesktopWindow());
return -1;
}
#ifndef ROSSHELL
if (cmdShow != SW_HIDE) {
/* // don't maximize if being called from the ROS desktop
if (cmdShow == SW_SHOWNORMAL)
///@todo read window placement from registry
cmdShow = SW_MAXIMIZE;
*/
explorer_show_frame(cmdShow, lpCmdLine);
}
#endif
Window::MessageLoop();
return 1;
}
示例14: catch
int synch_foo_generator::svc ()
{
::InterInArgsT::MyFoo_var my_foo_ami_ =
context_->get_connection_run_my_foo ();
ACE_OS::sleep (3);
//run some synch calls
CORBA::String_var out_str;
try
{
CORBA::Long result = my_foo_ami_->foo ("Do something synchronous",
cmd_synch_ok ,
out_str.out ());
if (result == (update_val + cmd_synch_ok))
{
++this->nr_of_received_;
}
}
catch (const InterInArgsT::InternalError&)
{
ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: "
"Unexpected exception.\n"));
}
try
{
my_foo_ami_->foo ("",cmd_synch_nok, out_str);
}
catch (const InterInArgsT::InternalError& ex)
{
HandleException (ex.id, (update_val + cmd_synch_nok),ex.error_string.in(),
"synch foo");
}
return 0;
}
示例15: CONTEXT
int ShellBrowserChild::InsertSubitems(HTREEITEM hParentItem, ShellDirectory* dir)
{
CONTEXT("ShellBrowserChild::InsertSubitems()");
WaitCursor wait;
int cnt = 0;
SendMessage(_left_hwnd, WM_SETREDRAW, FALSE, 0);
try {
dir->smart_scan();
} catch(COMException& e) {
HandleException(e, g_Globals._hMainWnd);
}
// remove old children items
for(HTREEITEM hchild,hnext=TreeView_GetChild(_left_hwnd, hParentItem); hchild=hnext; ) {
hnext = TreeView_GetNextSibling(_left_hwnd, hchild);
TreeView_DeleteItem(_left_hwnd, hchild);
}
TV_ITEM tvItem;
TV_INSERTSTRUCT tvInsert;
for(ShellEntry*entry=dir->_down; entry; entry=entry->_next) {
#ifndef _LEFT_FILES
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#endif
{
ZeroMemory(&tvItem, sizeof(tvItem));
tvItem.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN;
tvItem.pszText = LPSTR_TEXTCALLBACK;
tvItem.iImage = tvItem.iSelectedImage = I_IMAGECALLBACK;
tvItem.lParam = (LPARAM)entry;
tvItem.cChildren = entry->_shell_attribs & SFGAO_HASSUBFOLDER? 1: 0;
if (entry->_shell_attribs & SFGAO_SHARE) {
tvItem.mask |= TVIF_STATE;
tvItem.stateMask |= TVIS_OVERLAYMASK;
tvItem.state |= INDEXTOOVERLAYMASK(1);
}
tvInsert.item = tvItem;
tvInsert.hInsertAfter = TVI_LAST;
tvInsert.hParent = hParentItem;
TreeView_InsertItem(_left_hwnd, &tvInsert);
++cnt;
}
}
SendMessage(_left_hwnd, WM_SETREDRAW, TRUE, 0);
return cnt;
}