Boost logo

Geometry :

Subject: [ggl] Definition of exception types
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-06-14 03:38:39


Hi,

> I'd like to collect some thoughts and guidelines about exception types
> defined in GGL.
>
> Do we stick to Boost guidelines [1] ?
>
> Should we have abstract ggl::exception defined as std::exception
> subclass and derive all other exceptions from it?
>
I just added it on Friday. Just committed it. So yes, good idea.

> I'd suggest to prefer to std:: naming with _error postfix, for instance
> ggl::wkb::value_error, than what I have now:
> ggl::value_wkb_exception
> and others.
>
OK for me, but what is the reason to prefer _error above _exception?

> Among others, there seems to be two structures popular:
>
> 1. All GGL exceptions live directly in ggl:: and are defined in single
> file, for instance:
>
> ggl::wkb_value_error
> ggl::wkb_read_error
>
> 2. Exceptions are categorized using namespace
>
> ggl::wkb::value_error
> ggl::wkb::read_error
> ggl::wkb::write_error
> ggl::wkt::write_error
> ...
> ggl::algorithm::intersection_error
> ...
>
> Which to prefer?
>
I prefer to have exceptions close to which module they belong, so not in
a single file. This makes modularization more easy. Or is there another
reason to have everything in a single file?
The namespaces look OK to me, but it can grow and is subject to
discussion, because you can follow the folder structure or the
namespaces to which a module belong...

ggl::io::wkt::empty_error ...

> [1] http://www.boost.org/community/error_handling.html
>
Thanks,

Barend


Geometry list run by mateusz at loskot.net