[fdo-dev] Standard exceptions handling practice

Greg Boone greg.boone at autodesk.com
Fri Sep 1 15:05:09 EDT 2006


I would write something like...

try
{
    // operation that throws exception derived
    // from standard ex. type std::exception
    bar();
}
catch ( FdoException* ex )
{
    throw FdoException::Create(
        NlsMsgGet(XYZ_123_FAIL_BAR, "bar() failed"), ex);
}
catch ( std::exception &e )
{
    FdoExceptionP cause = 
	
FdoException::Create((FdoString*)(FdoStringP(e.what())));
    throw FdoException::Create(
		NlsMsgGet(XYZ_123_FAIL_BAR, "bar() failed"), cause);
}

-----Original Message-----
From: Mateusz Loskot [mailto:mateusz at loskot.net] 
Sent: Friday, September 01, 2006 2:14 PM
To: dev at fdo.osgeo.org
Subject: Re: [fdo-dev] Standard exceptions handling practice

Mateusz Loskot wrote:
> How about forwarding std::exception to FdoException hierarchy,
> for example to retrieve what() message?
> 
> void foo()
> {
>    try
>    {
>       // operation that throws exception derived
>       // from standard ex. type std::exception
>       bar();
>    }
>    catch(std::exception& ex)
>    {
>       throw FdoException::Create(
>                NlsMsgGet(XYZ_123_FAIL_BAR, "bar() failed"), ex);
-----------------------------------------------------------^^^^^^^

I know it won't work, because FdoException::create() does not take
std::exception type.
So, this is also my question.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at fdo.osgeo.org
For additional commands, e-mail: dev-help at fdo.osgeo.org






More information about the Fdo-internals mailing list