コード例 #1
0
/// End the current error message and clean-up for the next one.
void XSError::EndMsg( void )
{
    cerr << storedMsg;
    switch ( GetSeverity() )
    {
        case XSErrorFatal:
            SetNumErrors( XSErrorFatal, GetNumErrors( XSErrorFatal ) + 1 );
            *os << ( "Abnormal termination of program\n" );
#ifdef _WINDOWS
            if ( !batch )
                AfxMessageBox( storedMsg.c_str(), MB_ICONSTOP );
#endif
            exit( 1 );
            break;

        case XSErrorMajor:
            SetNumErrors( XSErrorMajor, GetNumErrors( XSErrorMajor ) + 1 );
#ifdef _WINDOWS
            if ( !batch )
                AfxMessageBox( storedMsg.c_str(), MB_ICONEXCLAMATION );
#endif
            storedMsg = "";
            SetState( XSErrorInitial );
            break;

        case XSErrorMinor:
            SetNumErrors( XSErrorMinor, GetNumErrors( XSErrorMinor ) + 1 );
#ifdef _WINDOWS
            if ( !batch )
                AfxMessageBox( storedMsg.c_str(), MB_ICONEXCLAMATION );
#endif
            storedMsg = "";
            SetState( XSErrorInitial );
            break;

        case XSErrorNone:
            SetNumErrors( XSErrorNone, GetNumErrors( XSErrorNone ) + 1 );
#ifdef _WINDOWS
            if ( !batch )
                AfxMessageBox( storedMsg.c_str(), MB_ICONINFORMATION );
#endif
            storedMsg = "";
            SetState( XSErrorInitial );
            break;

        default:
            SetSeverity( XSErrorMinor );
            *os << "\nerror severity was not set!\n";
            os->flush();
#ifdef _WINDOWS
            if ( !batch )
                AfxMessageBox( storedMsg.c_str(), MB_ICONINFORMATION );
#endif
            storedMsg = "";
            SetState( XSErrorInitial );
            break;
    } // switch
}     // EndMsg
コード例 #2
0
void CheckerboardEvent::StopEvent() {
  mCheckerboardingActive = false;
  mEndTime = TimeStamp::Now();

  if (!mRecordTrace) {
    return;
  }
  MonitorAutoLock lock(mRendertraceLock);
  if (mRendertraceInfo.tellp() >= LOG_LENGTH_LIMIT) {
    mRendertraceInfo << "[logging aborted due to length limitations]\n";
  }
  mRendertraceInfo << "Checkerboarded for " << mFrameCount << " frames ("
                   << (mEndTime - mStartTime).ToMilliseconds() << " ms), "
                   << mPeakPixels << " peak, " << GetSeverity() << " severity."
                   << std::endl;
}
コード例 #3
0
ファイル: ncbiexpt.cpp プロジェクト: swuecho/igblast
void CException::ReportStd(ostream& out, TDiagPostFlags flags) const
{
    string text(GetMsg());
    string err_type(GetType());
    err_type += "::";
    err_type += GetErrCodeString();
    SDiagMessage diagmsg(
        GetSeverity(),
        text.c_str(),
        text.size(),
        GetFile().c_str(),
        GetLine(),
        flags, NULL, 0, 0, err_type.c_str(),
        GetModule().c_str(),
        GetClass().c_str(),
        GetFunction().c_str());
    diagmsg.Write(out, SDiagMessage::fNoEndl | SDiagMessage::fNoPrefix);
}
コード例 #4
0
void ST_DiagnosticMsg(FileContext_C* pfc,
                      const TCHAR*  pszEdipos, 
                      HRESULT       err_id, 
                      const TCHAR** pszArgArray)
{
    TCHAR*  pBuf;    
    DWORD   dwRet;
    int     iSev;

    
    iSev = GetSeverity(err_id);
    //iSev is:
    //   00 - Success
    //   01 - Informational
    //   10 - Warning
    //   11 - Error
    if(pfc && iSev==3)//CAUTION: increment errors 
                      //in file even if ST_MAX_NUMBER_ERRORS
    {
        pfc->incrementErrorsInFile();
    }


    //no error/war msgs if too many errors but info msgs 
    //must still be displayed:
    if(nTotalErrors>=ST_MAX_NUMBER_ERRORS && iSev>=2)
        return;

    if(pszEdipos)
    {
        DumpUserText(pszEdipos);
        DumpUserText(_T(" : "));
    }

    dwRet = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
                          FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_FROM_SYSTEM|
                          FORMAT_MESSAGE_ARGUMENT_ARRAY, 
                          NULL, 
                          err_id, 
                          MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), //0, force english msgs... 
                          (LPTSTR)&pBuf, 
                          0, 
                          (TCHAR**)pszArgArray);


    if(dwRet==0)
    {
        assert(dwRet>0 && pBuf);
        if(pBuf==0 || dwRet==0)
        {
            pBuf = (TCHAR*)LocalLock(LocalAlloc(NONZEROLPTR, MAX_PATH));
            wsprintf(pBuf, MODULE_USER_NAME _T(" : internal error: no resource for error id 0x%x\n"),err_id );

        }

    }
    
    DumpUserText(pBuf);
    LocalFree(pBuf);

    if(iSev>=3)
    {
        nTotalErrors++;

        if(nTotalErrors==ST_MAX_NUMBER_ERRORS)
            ST_InfoMessage0(E_4CCG_ERR_TO_MANY_ERRORS);
    }
    else if(iSev==2)
    {
        nTotalWarnings++;
    }
}
コード例 #5
0
ファイル: ErrorManager.cpp プロジェクト: jrallo/hMailServer
   void 
   ErrorManager::ReportError(eSeverity iSeverity, int iErrorID, const String &sSource, const String &sDescription)
   {
#ifdef _ERROR_LOGGING_IN_MESSAGE_BOXES
      
      String sErrorToLog;
      sErrorToLog.Format(_T("%s"), 
                             sDescription);

      MessageBoxW(0, sErrorToLog, _T("hMailServer"), 0);

#else
      String sSeverityStr = GetSeverity(iSeverity);

      String sTempDesc = sDescription;
      sTempDesc.Replace(_T("\r\n"), _T("[nl]"));

      String sErrorToLog;
      sErrorToLog.Format(_T("Severity: %d (%s), Code: HM%d, Source: %s, Description: %s"), 
                            iSeverity, sSeverityStr, iErrorID, sSource, sTempDesc);

      Logger::Instance()->LogError(sErrorToLog); 

      // Send an event if we've been able to load our settings. During database
      // creation, we don't have any PropertySet in the cache but we should still
      // be able to report errors. During server start up, we have a property set (?)
      // but it's not initialized. So we need to be a bit careful here.
      if (Configuration::Instance()&& 
          Configuration::Instance()->GetPropertySet() && 
          Configuration::Instance()->GetUseScriptServer())
      {
         String sEventCaller;
         
         String sScriptLanguage = Configuration::Instance()->GetScriptLanguage();

         if (sScriptLanguage == _T("VBScript"))
         {
            String tempSource = sSource;
            String tempDescription = sDescription;
            
            tempSource.Replace(_T("\""), _T("\"\""));
            tempDescription.Replace(_T("\""), _T("\"\""));

            sEventCaller.Format(_T("OnError(%d, %d, \"%s\", \"%s\")"), 
                                    iSeverity, iErrorID, tempSource, tempDescription);
         }
         else if (sScriptLanguage == _T("JScript"))
         {
            String tempSource = sSource;
            String tempDescription = sDescription;

            tempSource.Replace(_T("'"), _T("\\'"));
            tempDescription.Replace(_T("'"), _T("\\'"));

            sEventCaller.Format(_T("OnError(%d, %d, '%s', '%s')"), 
                                    iSeverity, iErrorID, tempSource, tempDescription);
         }

         shared_ptr<ScriptObjectContainer> pContainer  = shared_ptr<ScriptObjectContainer>(new ScriptObjectContainer);
         
         ScriptServer::Instance()->FireEvent(ScriptServer::EventOnError, sEventCaller, pContainer);

      }
#endif
   }