#4242 closed enhancement (fixed)
[PATCH] Print filename in error messages related to rasterband and datasets
Reported by: | landry | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.0 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | warmerdam |
Description
I'm doing gdaldem hillshade on a vrt files with a lot of .asc files in it, and one of them is corrupted. Unfortunately, the error message is only : ERROR 3: File short, can't read line 149. ERROR 1: IReadBlock failed at X offset 0, Y offset 149
Messages comes from gcore/gdalrasterband.cpp and frmts/aaigrid/aaigriddataset.cpp, dunno if those files have the current dataset name in their context, but it'd be nice if it also printed it in error messages (at least in the context of vrt files)
Attachments (1)
Change History (5)
comment:1 by , 13 years ago
Cc: | added |
---|---|
Summary: | Print filename in error messages when using vrt files → [PATCH] Print filename in error messages related to rasterband and datasets |
by , 13 years ago
Attachment: | ticket_4242.patch added |
---|
comment:3 by , 13 years ago
Milestone: | → 1.9.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Type: | defect → enhancement |
r23077 /trunk/gdal/gcore/ (gdal_priv.h gdaldataset.cpp gdalrasterband.cpp): Add GDALRasterBand::ReportError() and GDALDataset::ReportError() to prepend dataset name (and band) before error message (#4242)
r23078 /trunk/gdal/gcore/ (gdaldataset.cpp gdalrasterband.cpp): Convert CPLError() to ReportError() (#4242)
Frank,
what would you think of the attached patch that introduces a ReportError() method on rasterband and dataset class ? This method has same signature of CPLError(), but just prepends the dataset name (and band number in the case of rasterband) to the error message. As a proof of concept, I've transformed the relevant CPLError() calls of gdalrasterband.cpp and gdaldataset.cpp, but it could also be progressively used by drivers in their derived classes. 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.
(It would also have the potential to serve as a centralization point if some day we wanted to provide per-dataset or per-rasterband custom error handlers. But that's more a side-effect.)