[fdo-internals] Logging on exceptions

Traian Stanev traian.stanev at autodesk.com
Wed Apr 25 10:49:20 EDT 2007


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


-----Original Message-----
From: fdo-internals-bounces at lists.osgeo.org
[mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Mateusz
Loskot
Sent: Tuesday, April 24, 2007 6:44 PM
To: fdo-internals
Subject: [fdo-internals] Logging on exceptions

Hi,

While I'm testing the fdopostgis provider I use heavy logging, so in
many places my code looks as follows:

try
{
   foo()
}
catch (FdoException* e)
{
   FDOLOG_WRITE("...");

   throw FdoCommandException::Create(...);
}

Honestly, I don't like when developer's tool is very explicit and
intrusive, what makes code less readable.

I'm thinking about creating my own sub-tree of exception types in which
I could automatically log a message/state in Create() operation of an
exception.

Do you think it's a good idea that I derive my own exceptions from FDO
types and instrument it with some utilities internally?

The logging is controlled in compilation time, similarly as assertions,
so I can turn it off any time when building.

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




More information about the fdo-internals mailing list