Skip to content

Commit 9834859

Browse files
authoredFeb 25, 2019
Merge pull request #9239 from m-kuhn/better-error-messages-gpkg-fail
Better error message when failed to open DB
2 parents 9f576b6 + 1f4747f commit 9834859

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

Lines changed: 3 additions & 1 deletion
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)
Please sign in to comment.