[postgis-users] Error handling: GEOS throws in PostGIS.

Norman Vine nhv at cape.com
Fri Apr 11 17:33:54 PDT 2003


Martin Davis writes:
> 
> Is what you're suggesting this:  
> 
> Catch all GEOS errors internally and return a status code 
> instead. If a method already has a return value, return NULL
> 
> This seems like a pretty substantial change to GEOS.  Does it 
> mean that everyone using GEOS now has to check return codes, 
> instead of using exceptions?

Fortunately I don't think this is what Dave is suggesting see below
 
> Is there any way of providing a yet higher wrapper in between 
> GEOS and PostGIS which converts exceptions into return codes (so 
> that GEOS is kept pure and PostGIS can call it safely)?

YES !!

This is the 'C' wrapper layer that PostGIS needs
The GEOS C++ code does not need to change as it will be
the responsibility of the 'C' wrapper to map the GEOS errors
into 'C' return codes

>> Dave wrote: 
> > 
> > So, unless anyone has any bright ideas, we could think about 
> > putting a C 
> > api directly in GEOS.  If we use the standard C way of error handling 
> > (return an error code or NULL, like in the above), PostGIS 
> > should have 
> > no problems.  Unfortunately, this does
> > "pollute" GEOS.
> > 
> > What think?

Sounds like a plan to me

Cheers

Norman







More information about the postgis-users mailing list