Skip to content


Better error message when failed to open DB
Browse files Browse the repository at this point in the history
hopefully gives some hints why the db manager tests sometimes fail
  • Loading branch information
m-kuhn committed Feb 21, 2019
1 parent 9f77b2d commit 1f4747f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/plugins/db_manager/db_plugins/gpkg/
Expand Up @@ -59,8 +59,10 @@ def _opendb(self):
self.gdal_ds = gdal.OpenEx(self.dbname, gdal.OF_UPDATE)
if self.gdal_ds is None:
self.gdal_ds = gdal.OpenEx(self.dbname)
if self.gdal_ds is None or self.gdal_ds.GetDriver().ShortName != 'GPKG':
if self.gdal_ds is None:
raise ConnectionError(QApplication.translate("DBManagerPlugin", '"{0}" not found').format(self.dbname))
if self.gdal_ds.GetDriver().ShortName != 'GPKG':
raise ConnectionError(QApplication.translate("DBManagerPlugin", '"{dbname}" not recognized as GPKG ({shortname} reported instead.)').format(dbname=self.dbname, shortname=self.gdal_ds.GetDriver().ShortName))
self.has_raster = self.gdal_ds.RasterCount != 0 or self.gdal_ds.GetMetadata('SUBDATASETS') is not None
self.connection = None

Expand Down

0 comments on commit 1f4747f

Please sign in to comment.