[Gdal-dev] CPLErrorV change to better support scriptland

Frank Warmerdam fwarmerdam at gmail.com
Mon Jun 20 10:04:10 EDT 2005


On 6/20/05, Kevin Ruland <kruland at ku.edu> wrote:
> 
> Frank:
> 
> Fair enough solution.
> 
> But I think I could trump the whole thing and let you do what you need
> to do.  Suppose in language binding X (where X = python :) I write my
> own special little ErrorHandler.  And further this ErrorHandler does not
> return to the caller (CPLErrorV) but rather throws.  Then in the Swig
> binding world, I catch this throw and convert into an appropriate
> exception in language X.  Of course, there are some issues:  1)  Need to
> have swig generated try blocks around *every* native call.  2) I don't
> know how this would interact with user supplied error handlers.  The
> user supplied error handler would have to raise/throw/whatever in order
> to trump the abort().  This might be fairly simple to do in the ScriptX
> <-> ErrorHandler mapping wrapper, but there could be some rather wierd
> issues.

Kevin,

Certainly the error handlers installed can choose to do something
other than returning if the error class is CE_Fatal.  But keep in mind
that the error class is set to fatal because continued execution on 
the main code path is not possible.  GDAL datastructures are likely
to be arbitrarily invalid after such an error.  

PS. I have committed the patch to remove the fatal error in
the GetRasterBand() method.  

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the Gdal-dev mailing list