[gdal-dev] Lost error messages

Even Rouault even.rouault at spatialys.com
Tue Jan 30 03:26:09 PST 2024


Ray,

Le 30/01/2024 à 05:43, Ray at Daylon via gdal-dev a écrit :
> I was tracing through the TIGER/Line OGR driver and noticed that
> it calls OGRTigerDataSource::Open with the bTestOpen parameter
> set to TRUE, causing that function to skip calling CPLError
> and only return FALSE if an error happens.
>
> This causes an interesting situation: an app can have the TIGER driver 
> fail, but not be told why. Calling CPLGetLastErrorXXX doesn't help 
> because no error condition was formally reported.
>
> Is there a reason why bTestOpen is set to TRUE? Shouldn't
> full error reporting be the default? If this parameter is
> important, shouldn't it be part of the driver API so an app
> can set it to get errors described?

I presume this is mostly a copy&paste pattern borrowed from the 
Shapefile driver. Basically the reason to be silent in most situations 
is that the Tiger driver opens a directory, and there's no easy way to 
know in advance if a directory belongs to the Tiger driver, or the 
Shapefile one, or the MITAB one, or etc.. than iterating over its files 
and checking if they have  extensions that look like a Tiger dataset. So 
failure of finding such file shouldn't trigger a verbose error, 
otherwise this would prevent other drivers to also try checking if they 
recognize the content of the directory.

And congratulations: you're the first user in recent times I'm aware of 
to have interest in that driver ;-) Or perhaps that was just accidental?

Even

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list