void RethrowException(Exception * E) { // this list has to be in sync with ExceptionMessage if (isa<EFatal>(E)) { throw EFatal(E, L""); } else if (isa<ECallbackGuardAbort>(E)) { throw ECallbackGuardAbort(); } else if (isa<EAbort>(E)) { throw EAbort(E->Message); } else if (WellKnownException(E, nullptr, nullptr, nullptr, true)) { // noop, should never get here } else { throw ExtException(E, L""); } }
void RethrowException(Exception * E) { // this list has to be in sync with ExceptionMessage if (NB_STATIC_DOWNCAST(EFatal, E) != nullptr) { throw EFatal(E, L""); } else if (NB_STATIC_DOWNCAST(ECallbackGuardAbort, E) != nullptr) { throw ECallbackGuardAbort(); } else if (NB_STATIC_DOWNCAST(EAbort, E) != nullptr) { throw EAbort(E->Message); } else if (WellKnownException(E, nullptr, nullptr, nullptr, true)) { // noop, should never get here } else { throw ExtException(E, L""); } }
void TActionLog::Add(UnicodeString Line) { DebugAssert(FConfiguration); if (FLogging) { TGuard Guard(FCriticalSection); if (FLogger == nullptr) { OpenLogFile(); } if (FLogger != nullptr) { try { UTF8String UtfLine = UTF8String(Line); size_t Written = FLogger->Write(UtfLine.c_str(), UtfLine.Length()); if (Written != static_cast<size_t>(UtfLine.Length())) { throw ECRTExtException(L""); } Written = FLogger->Write("\n", 1); if (Written != 1) { throw ECRTExtException(L""); } } catch (Exception &E) { // FCriticalSection.Release(); // avoid endless loop when trying to close tags when closing log, when logging has failed if (!FFailed) { FFailed = true; // We failed logging, turn it off and notify user. FConfiguration->SetLogActions(false); if (FConfiguration->GetLogActionsRequired()) { throw EFatal(&E, LoadStr(LOG_FATAL_ERROR)); } else { try { throw ExtException(&E, LoadStr(LOG_GEN_ERROR)); } catch (Exception &E2) { if (FUI != nullptr) { FUI->HandleExtendedException(&E2); } } } } } } } }