Skip to content

Commit 1f4747f

Browse files
committed
Better error message when failed to open DB
hopefully gives some hints why the db manager tests sometimes fail
1 parent 9f77b2d commit 1f4747f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/plugins/db_manager/db_plugins/gpkg/connector.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ def _opendb(self):
5959
self.gdal_ds = gdal.OpenEx(self.dbname, gdal.OF_UPDATE)
6060
if self.gdal_ds is None:
6161
self.gdal_ds = gdal.OpenEx(self.dbname)
62-
if self.gdal_ds is None or self.gdal_ds.GetDriver().ShortName != 'GPKG':
62+
if self.gdal_ds is None:
6363
raise ConnectionError(QApplication.translate("DBManagerPlugin", '"{0}" not found').format(self.dbname))
64+
if self.gdal_ds.GetDriver().ShortName != 'GPKG':
65+
raise ConnectionError(QApplication.translate("DBManagerPlugin", '"{dbname}" not recognized as GPKG ({shortname} reported instead.)').format(dbname=self.dbname, shortname=self.gdal_ds.GetDriver().ShortName))
6466
self.has_raster = self.gdal_ds.RasterCount != 0 or self.gdal_ds.GetMetadata('SUBDATASETS') is not None
6567
self.connection = None
6668

0 commit comments

Comments
 (0)