Skip to content
Permalink
Browse files

Better error message when failed to open DB

hopefully gives some hints why the db manager tests sometimes fail
  • Loading branch information
m-kuhn committed Feb 21, 2019
1 parent 9f77b2d commit 1f4747fe62efe648408916f5cd8f35b93c692a74
Showing with 3 additions and 1 deletion.
  1. +3 −1 python/plugins/db_manager/db_plugins/gpkg/connector.py
@@ -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

0 comments on commit 1f4747f

Please sign in to comment.
You can’t perform that action at this time.