[gdal-dev] Throwing exceptions in GDAL Error Handler

Simon Eves simon.eves at omnisci.com
Sat Dec 4 15:49:26 PST 2021


We have a custom Error Handler callback and for a while now it was
configured to throw an exception if the class was Failure or higher.

Unfortunately, we have found that this causes havoc with OpenEx() because
the file management state is left bad (e.g. the anti-recursion stuff) and
GDAL will believe the file is open when it isn't, and other such hilarity.

We have changed this to disable and re-enable the exception throw (and just
log the error) either side of an OpenEx() but I am concerned that there are
perhaps other situations where throwing may cause similar issues.

The docs for CPLSetErrorHandler() don't explicitly say anything about not
throwing in the callback.

Please advise.

SE

-- 
<http://www.omnisci.com/>
Simon Eves
Senior Graphics Engineer, Rendering Group
100 Montgomery St (5th Floor), San Francisco, CA 94104, USA


Email: simon.eves at omnisci.com | Cell:  +1 (415) 902-1996
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211204/55213b5f/attachment.html>


More information about the gdal-dev mailing list