//--------------------------------------------------------------------------- // @function: // CXformImplementAssert::Transform // // @doc: // Actual transformation // //--------------------------------------------------------------------------- void CXformImplementAssert::Transform ( CXformContext *pxfctxt, CXformResult *pxfres, CExpression *pexpr ) const { GPOS_ASSERT(NULL != pxfctxt); GPOS_ASSERT(FPromising(pxfctxt->Pmp(), this, pexpr)); GPOS_ASSERT(FCheckPattern(pexpr)); IMemoryPool *pmp = pxfctxt->Pmp(); // extract components CLogicalAssert *popAssert = CLogicalAssert::PopConvert(pexpr->Pop()); CExpression *pexprRelational = (*pexpr)[0]; CExpression *pexprScalar = (*pexpr)[1]; CException *pexc = popAssert->Pexc(); // addref all children pexprRelational->AddRef(); pexprScalar->AddRef(); // assemble physical operator CPhysicalAssert *popPhysicalAssert = GPOS_NEW(pmp) CPhysicalAssert ( pmp, GPOS_NEW(pmp) CException(pexc->UlMajor(), pexc->UlMinor(), pexc->SzFilename(), pexc->UlLine()) ); CExpression *pexprAssert = GPOS_NEW(pmp) CExpression ( pmp, popPhysicalAssert, pexprRelational, pexprScalar ); // add alternative to results pxfres->Add(pexprAssert); }
//--------------------------------------------------------------------------- // @function: // CErrorHandlerStandard::Process // // @doc: // Process pending error context; // //--------------------------------------------------------------------------- void CErrorHandlerStandard::Process ( CException exc ) { CTask *ptsk = CTask::PtskSelf(); GPOS_ASSERT(NULL != ptsk && "No task in current context"); IErrorContext *perrctxt = ptsk->Perrctxt(); CLogger *plog = dynamic_cast<CLogger*>(ptsk->PlogErr()); GPOS_ASSERT(perrctxt->FPending() && "No error to process"); GPOS_ASSERT(perrctxt->Exc() == exc && "Exception processed different from pending"); // print error stack trace if (CException::ExmaSystem == exc.UlMajor() && !perrctxt->FRethrow()) { if ((CException::ExmiIOError == exc.UlMinor() || CException::ExmiNetError == exc.UlMinor() ) && 0 < errno) { perrctxt->AppendErrnoMsg(); } if (ILogger::EeilMsgHeaderStack <= plog->Eil()) { perrctxt->AppendStackTrace(); } } // scope for suspending cancellation { // suspend cancellation CAutoSuspendAbort asa; // log error message plog->Log(perrctxt->WszMsg(), perrctxt->UlSev(), __FILE__, __LINE__); } }
//--------------------------------------------------------------------------- // @function: // COptimizer::HandleExceptionAfterFinalizingMinidump // // @doc: // Handle exception after finalizing minidump // //--------------------------------------------------------------------------- void COptimizer::HandleExceptionAfterFinalizingMinidump ( CException &ex ) { if (NULL != ITask::PtskSelf() && !ITask::PtskSelf()->Perrctxt()->FPending()) { // if error context has no pending exception, then minidump creation // might have reset the error, // in this case we need to raise the original exception GPOS_RAISE ( ex.UlMajor(), ex.UlMinor(), GPOS_WSZ_LIT("re-raising exception after finalizing minidump") ); } // otherwise error is still pending, re-throw original exception GPOS_RETHROW(ex); }