[geos-devel] Re: [postgis-users] GEOS / Predicates Update
Norman Vine
nhv at cape.com
Thu May 22 15:55:24 EDT 2003
Ferdinando Villa writes:
>
> > > - Re-write some chunks of GEOS to not throw exceptions. This is bad
> > > for two reasons. It is a large amount of work, and it also is bad
> > > design. The exceptions are there for a reason, and replacing
> them with
> > > large chains of null handling will be unpleasant. There are some
> > > "exception emulation" libraries for C which could make the
> process less
> > > unpleasant, but it will still not be nice at all.
> >
> > I'm voting for this option because I think the compiler-and-library
> > version problem will solve itself over time (click your feet and say
> > "there's no place like home").
> ...or maybe something like
>
> template <typename return_value_of_func>
> bool handle_error(GeosException* exc, return_value_of_func error_return)
> throw (GeosException*)
> {
> if (geos::use_exceptions)
> throw exc;
> else
> delete exc;
> return error_return;
> }
>
> and instead of
> throw new GeosException(...);
> we write
> return handle_geos_error(new GeosException(...),
> whatever_we_should_return);
>
> may be a bit of a pain to use the return value and it's ugly, but it
> would control it all with a single global var and leave the exceptions
> as a default option.
I thnk that should work :)
But... I can't help but wonder if the problem wouldn't automagically
disappear if we compiled the PostGIS code as C++ and made the
GEOS part of PostGIS a real C++ module that knew all about
handling exceptions
Cheers
Norman
More information about the geos-devel
mailing list