[fdo-internals] Logging on exceptions

Mateusz Loskot mateusz at loskot.net
Wed Apr 25 12:15:02 EDT 2007


Traian Stanev wrote:
> Not sure if the example is out of context, but why do you catch an 
> FdoException only to rethrow it as another? That only hides the real
>  source of the error. Is it just for the logging?
> 

Traian,

I think the example is not very good.
I do catch and rethrow if:
- I want to translate std/boost exceptions to FDO
- I need to clean resources manually

try
{
...
}
catch
{
   PQclean(result);
} // rethrow

- and sometimes, when I have to clean resources, I want to put
additional information, so I rethrow manually with some translation

try
{
...
}
catch
{
   PQclean(result);
   throw ....
}

I have to confess that I've never used exceptions rolling practice
as it occurs in FDO, so I may be lack of knowledge how and when it
should be used and when it's not recommended.


Doesn't the rolling mechanism preserve actual
context of source of error well?

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


More information about the fdo-internals mailing list