Пример #1
0
//---------------------------------------------------------------------------
//	@function:
//		CException::Reraise
//
//	@doc:
//		Throw/rethrow interface to reraise an already caught exc;
//		Wrapper that asserts there is a pending error;
//
//---------------------------------------------------------------------------
void
CException::Reraise
	(
	CException exc,
	BOOL fPropagate
	)
{
	if (NULL != ITask::PtskSelf())
	{
		CErrorContext *perrctxt = CTask::PtskSelf()->PerrctxtConvert();
		GPOS_ASSERT(perrctxt->FPending());

		perrctxt->SetRethrow();

		// serialize registered objects when current task propagates
		// an exception thrown by a child task
		if (fPropagate)
		{
			perrctxt->Psd()->BackTrace();
			perrctxt->Serialize();
		}
	}

	Raise(exc);
}
Пример #2
0
//---------------------------------------------------------------------------
//	@function:
//		CException::Raise
//
//	@doc:
//		Actual point where an exception is thrown; encapsulated in a function 
//		(a) to facilitate debugging, i.e. function to set a breakpoint
//		(b) to allow for additional debugging tools such as stack dumps etc.
//			at a later point in time
//
//---------------------------------------------------------------------------
void
CException::Raise
	(
	const CHAR *szFilename,
	ULONG ulLine,
	ULONG ulMajor,
	ULONG ulMinor,
	...
	)
{
	// manufacture actual exception object
	CException exc(ulMajor, ulMinor, szFilename, ulLine);
	
	// during bootstrap there's no context object otherwise, record
	// all details in the context object
	if (NULL != ITask::PtskSelf())
	{
		CErrorContext *perrctxt = CTask::PtskSelf()->PerrctxtConvert();

		VA_LIST valist;
		VA_START(valist, ulMinor);

		perrctxt->Record(exc, valist);

		VA_END(valist);

		perrctxt->Serialize();
	}

	Raise(exc);
}