static void date_time_list_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value) { EDateTimeList *date_time_list = E_DATE_TIME_LIST (tree_model); struct icaltimetype *itt; GList *l; const gchar *str; g_return_if_fail (E_IS_DATE_TIME_LIST (tree_model)); g_return_if_fail (column < E_DATE_TIME_LIST_NUM_COLUMNS); g_return_if_fail (E_DATE_TIME_LIST (tree_model)->priv->stamp == iter->stamp); g_return_if_fail (IS_VALID_ITER (date_time_list, iter)); g_value_init (value, column_types[column]); if (!date_time_list->priv->list) return; l = iter->user_data; itt = l->data; if (!itt) return; switch (column) { case E_DATE_TIME_LIST_COLUMN_DESCRIPTION: str = get_exception_string (date_time_list, itt); g_value_set_string (value, str); break; } }
/// End try block, set the error message if any and return true if an error /// occurred. /// /// @param err Pointer to the stack-allocated error object /// @return true if an error occurred bool try_end(Error *err) { --trylevel; // Without this it stops processing all subsequent VimL commands and // generates strange error messages if I e.g. try calling Test() in a // cycle did_emsg = false; if (got_int) { if (did_throw) { // If we got an interrupt, discard the current exception discard_current_exception(); } api_set_error(err, Exception, _("Keyboard interrupt")); got_int = false; } else if (msg_list != NULL && *msg_list != NULL) { int should_free; char *msg = (char *)get_exception_string(*msg_list, ET_ERROR, NULL, &should_free); xstrlcpy(err->msg, msg, sizeof(err->msg)); err->set = true; free_global_msglist(); if (should_free) { xfree(msg); } } else if (did_throw) { api_set_error(err, Exception, "%s", current_exception->value); discard_current_exception(); } return err->set; }
////////////////////////////////////////////////////////////////////////// //截获异常信息,并生成自定义的异常报告和弹出窗口 ////////////////////////////////////////////////////////////////////////// LONG WINAPI CustomExceptionFun(struct _EXCEPTION_POINTERS* ExceptionInfo) { SetUnhandledExceptionFilter(NULL); CString logPath,folderPath,errDetail; CString tips; CString strDes,strStack; CTime timer; CStdioFile stFile; TCHAR sz_module[MAX_PATH] = {0}; UINT_PTR section = 0, offset = 0; strDes.Format(L"%s\r\n%s",L"我们很抱歉地通知您,程序遇到错误,不得不终止。",L"以下是该错误的详细信息:"); //werDlg.SetDes(strDes); TCHAR szFileName[MAX_PATH]; ::GetModuleFileName(NULL, szFileName, MAX_PATH); *(_tcsrchr(szFileName, _T('\\')) + 1) = 0; timer = CTime::GetCurrentTime(); folderPath.Format(L"%slog\\",szFileName); logPath.Format(L"%slog\\dump_%d_%d_%d_%d.txt", szFileName, timer.GetYear(), timer.GetMonth(), timer.GetDay(), timer.GetHour()); tips.Format(L"%s\r\n%s",L"以上错误信息保存在:",logPath); g_strErrLogPath = logPath; //生成错误地址 get_logical_address(ExceptionInfo->ExceptionRecord->ExceptionAddress, sz_module, sizeof(sz_module)); //生成堆栈信息 stack_walk(strStack,ExceptionInfo->ContextRecord); //生成寄存器信息 #ifdef _M_IX86 // Intel Only! CString strReg; strReg = L"\nRegisters:\r\n"; strReg.Format(L"%sEAX:%08X\r\nEBX:%08X\r\nECX:%08X\r\nEDX:%08X\r\nESI:%08X\r\nEDI:%08X\r\n", strReg,ExceptionInfo->ContextRecord->Eax, ExceptionInfo->ContextRecord->Ebx, ExceptionInfo->ContextRecord->Ecx, ExceptionInfo->ContextRecord->Edx, ExceptionInfo->ContextRecord->Esi, ExceptionInfo->ContextRecord->Edi ); strReg.Format(L"%sCS:EIP: %04X:%08X\r\n",strReg, ExceptionInfo->ContextRecord->SegCs, ExceptionInfo->ContextRecord->Eip); strReg.Format(L"%sSS:ESP: %04X:%08X \r\nEBP:%08X\r\n",strReg, ExceptionInfo->ContextRecord->SegSs, ExceptionInfo->ContextRecord->Esp, ExceptionInfo->ContextRecord->Ebp ); strReg.Format(L"%sDS:%04X ES:%04X FS:%04X GS:%04X\r\n", strReg,ExceptionInfo->ContextRecord->SegDs, ExceptionInfo->ContextRecord->SegEs, ExceptionInfo->ContextRecord->SegFs, ExceptionInfo->ContextRecord->SegGs ); strReg.Format(L"%sFlags:%08X\r\n",strReg, ExceptionInfo->ContextRecord->EFlags); #endif //_M_IX86 //生成错误详细信息 errDetail.Format(L"Error Code:%x\r\n%s\r\nAddress:%x\r\n%s\r\n\r\n%s\r\n%s", ExceptionInfo->ExceptionRecord->ExceptionCode, get_exception_string(ExceptionInfo->ExceptionRecord->ExceptionCode), ExceptionInfo->ExceptionRecord->ExceptionAddress, sz_module, strReg, strStack); g_strErrDetail = errDetail; //写日志 CFileFind fileFinder; if (!fileFinder.FindFile(folderPath)) { if (::CreateDirectory(folderPath,NULL) < 0) return EXCEPTION_EXECUTE_HANDLER; } if (stFile.Open(logPath,CFile::modeCreate | CFile::modeNoTruncate | CFile::modeReadWrite | CFile::typeBinary)) { stFile.SeekToEnd(); stFile.Write("\377\376", 2); stFile.WriteString(errDetail); stFile.Close(); } //werDlg.DoModal(); CreateWerWindow(logPath,errDetail); return EXCEPTION_EXECUTE_HANDLER; }