Skip to content

Commit

Permalink
VRT: use GDAL_OF_VERBOSE_ERROR flag in vrt:// and pansharpened modes
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Oct 4, 2024
1 parent 9660894 commit 28784ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
11 changes: 7 additions & 4 deletions frmts/vrt/vrtdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,9 @@ GDALDataset *VRTDataset::OpenVRTProtocol(const char *pszSpec)
// http://.jp2 file with the JP2OpenJPEG driver through the HTTP driver,
// which returns a /vsimem/ file
auto poSrcDS = std::unique_ptr<GDALDataset, GDALDatasetUniquePtrReleaser>(
GDALDataset::Open(osFilename, GDAL_OF_RASTER, aosAllowedDrivers.List(),
aosOpenOptions.List(), nullptr));
GDALDataset::Open(osFilename, GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
aosAllowedDrivers.List(), aosOpenOptions.List(),
nullptr));
if (poSrcDS == nullptr)
{
return nullptr;
Expand Down Expand Up @@ -1103,7 +1104,8 @@ GDALDataset *VRTDataset::OpenVRTProtocol(const char *pszSpec)
if (bFound)
{
poSrcDS.reset(GDALDataset::Open(
osSubdatasetSource.c_str(), GDAL_OF_RASTER,
osSubdatasetSource.c_str(),
GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
aosAllowedDrivers.List(), aosOpenOptions.List(),
nullptr));
if (poSrcDS == nullptr)
Expand Down Expand Up @@ -1158,7 +1160,8 @@ GDALDataset *VRTDataset::OpenVRTProtocol(const char *pszSpec)
}

poSrcDS.reset(GDALDataset::Open(
osSubdatasetSource.c_str(), GDAL_OF_RASTER,
osSubdatasetSource.c_str(),
GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
aosAllowedDrivers.List(), aosOpenOptions.List(), nullptr));
if (poSrcDS == nullptr)
{
Expand Down
13 changes: 5 additions & 8 deletions frmts/vrt/vrtpansharpened.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,11 @@ CPLErr VRTPansharpenedDataset::XMLInit(const CPLXMLNode *psTree,
const CPLStringList aosOpenOptions(
GDALDeserializeOpenOptionsFromXML(psPanchroBand));

poPanDataset = GDALDataset::Open(osSourceFilename, GDAL_OF_RASTER,
poPanDataset = GDALDataset::Open(osSourceFilename,
GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
nullptr, aosOpenOptions.List());
if (poPanDataset == nullptr)
{
CPLError(CE_Failure, CPLE_AppDefined, "%s not a valid dataset",
osSourceFilename.c_str());
return CE_Failure;
}
poPanDatasetToClose = poPanDataset;
Expand Down Expand Up @@ -559,13 +558,11 @@ CPLErr VRTPansharpenedDataset::XMLInit(const CPLXMLNode *psTree,
const CPLStringList aosOpenOptions(
GDALDeserializeOpenOptionsFromXML(psIter));

poDataset = GDALDataset::Open(osSourceFilename, GDAL_OF_RASTER,
nullptr, aosOpenOptions.List());
poDataset = GDALDataset::Open(
osSourceFilename, GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
nullptr, aosOpenOptions.List());
if (poDataset == nullptr)
{
CPLError(CE_Failure, CPLE_AppDefined,
"%s not a valid dataset",
osSourceFilename.c_str());
goto error;
}
oMapNamesToDataset[osSourceFilename] = poDataset;
Expand Down

0 comments on commit 28784ac

Please sign in to comment.