Skip to content
Permalink
Browse files

Improve error reporting

  • Loading branch information
m-kuhn authored and nyalldawson committed Jan 10, 2020
1 parent 9ac6c66 commit 524e1b0433474354e2efcd31d16002d5f95394b0
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/analysis/processing/qgsalgorithmpackage.cpp
@@ -109,12 +109,18 @@ QVariantMap QgsPackageAlgorithm::processAlgorithm( const QVariantMap &parameters
gdal::ogr_datasource_unique_ptr hDS;

if ( !QFile::exists( packagePath ) )
{
hDS = gdal::ogr_datasource_unique_ptr( OGR_Dr_CreateDataSource( hGpkgDriver, packagePath.toUtf8().constData(), nullptr ) );
if ( !hDS )
throw QgsProcessingException( QObject::tr( "Creation of database %1 failed (OGR error: %2)" ).arg( packagePath, QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
}
else
{
hDS = gdal::ogr_datasource_unique_ptr( OGROpen( packagePath.toUtf8().constData(), true, nullptr ) );
if ( !hDS )
throw QgsProcessingException( QObject::tr( "Opening database %1 failed (OGR error: %2)" ).arg( packagePath, QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
}

if ( !hDS )
throw QgsProcessingException( QObject::tr( "Creation of database failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );

bool errored = false;

0 comments on commit 524e1b0

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