[fdo-internals] Unwinding FDO exceptions

Greg Boone greg.boone at autodesk.com
Sun Feb 4 16:56:13 EST 2007


You results look accurate. FILO behaviour is as expected.

	-----Original Message----- 
	From: fdo-internals-bounces at lists.osgeo.org on behalf of Mateusz Loskot 
	Sent: Sun 2/4/2007 2:34 AM 
	To: fdo-internals 
	Cc: 
	Subject: [fdo-internals] Unwinding FDO exceptions
	
	

	Hello,
	
	I'm not sure I understand how to process the roll of FDO exceptions,
	so I'd like to ask for confirmation if I'm correct or not.
	
	Here are blocks of nested try-catch that mimic situation in which an
	exception is thrown by a callee and re-thrown by a caller, and so on.
	In the catch clause, is presented the idea of unwinding nested
	exception, using some pseudo-code to make the example simpler.
	
	//------------------------------------
	try
	{
	  try
	  {
	    try
	    {
	      throw FdoException::Create(L"First exception");
	    }
	    catch (FdoException* ex)
	    {
	      throw FdoException::Create(L"Second caused by first", ex);
	    }
	  }
	  catch (FdoException* ex)
	  {
	      throw FdoException::Create(L"Third caused by second", ex);
	  }
	}
	catch (FdoException* ex)
	{
	  // echo is a pseudo-code representing stdout action
	  echo "*** FDO FAILURE ***\n"
	  echo ex->GetExceptionMessage()
	
	  FdoPtr<FdoException> cause(ex->GetCause());
	  while(NULL != cause)
	  {
	    echo "*** " + cause->GetExceptionMessage() + "\n"
	
	    cause = cause->GetCause();
	  }
	  ex->Release();
	}
	//------------------------------------
	
	
	And here is the output:
	
	*** FDO FAILURE ***
	  *** Third caused by second
	   *** Second caused by first
	    *** First exception
	
	
	Is this output correct and as usually expected in FDO?
	Is this correct to assume that exceptions are
	queued as in FILO, First In - Last Out ?
	
	
	Cheers
	--
	Mateusz Loskot
	http://mateusz.loskot.net
	_______________________________________________
	fdo-internals mailing list
	fdo-internals at lists.osgeo.org
	http://lists.osgeo.org/mailman/listinfo/fdo-internals
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-internals/attachments/20070204/dd5c2b56/attachment.html


More information about the fdo-internals mailing list