Skip to content
Permalink
Browse files

Merge pull request #9239 from m-kuhn/better-error-messages-gpkg-fail

Better error message when failed to open DB
  • Loading branch information
m-kuhn committed Feb 25, 2019
2 parents 9f576b6 + 1f4747f commit 98348599d3d6a35e0fa8de9c9235632b61756bf6
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 9834859

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