Skip to content

Commit

Permalink
Improve error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and nyalldawson committed Jan 12, 2020
1 parent 9ac6c66 commit 524e1b0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/analysis/processing/qgsalgorithmpackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 524e1b0

Please sign in to comment.