[gdal-dev] New way of reporting of errors related to GDAL datasets and bands.

Even Rouault even.rouault at mines-paris.org
Wed Sep 7 18:06:04 EDT 2011


Hi,

This will interest mostly GDAL driver authors.

I've just added ( http://trac.osgeo.org/gdal/changeset/23077 ) 2 new methods, 
GDALRasterBand::ReportError() and GDALDataset::ReportError(), that prepend the 
dataset name (and band) before the actual error message.

The use case that lead to their introduction is when processing a larger 
number of datasets and an error suddenly occurs in the middle of the 
processing, without any convenient way of identifying which dataset triggered 
the error. See http://trac.osgeo.org/gdal/ticket/4242 .

Those ReportError() methods have the same arguments as CPLError(), so it is 
easy to switch on them. The main advantage is that it is a way of providing 
consistant formatting to report dataset/rasterband related errors, while 
reducing the footprint at each place where we emit the errors. 

For now, only gdaldataset.cpp and gdalrasterband.cpp have been converted to 
use them.

Best regards,

Even


More information about the gdal-dev mailing list