Skip to content

Commit

Permalink
[Geometry checker] Be more verbose about output file creation failure…
Browse files Browse the repository at this point in the history
… reason
  • Loading branch information
manisandro committed Jan 19, 2016
1 parent 2065850 commit 9b7afc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -218,10 +218,11 @@ void QgsGeometryCheckerSetupTab::runChecks()
QgsMapLayerRegistry::instance()->removeMapLayers( toRemove );
}

QgsVectorFileWriter::WriterError err = QgsVectorFileWriter::writeAsVectorFormat( layer, filename, layer->dataProvider()->encoding(), &layer->crs(), mOutputDriverName, selectedOnly );
QString errMsg;
QgsVectorFileWriter::WriterError err = QgsVectorFileWriter::writeAsVectorFormat( layer, filename, layer->dataProvider()->encoding(), &layer->crs(), mOutputDriverName, selectedOnly, &errMsg );
if ( err != QgsVectorFileWriter::NoError )
{
QMessageBox::critical( this, tr( "Layer Creation Failed" ), tr( "Failed to create the output layer." ) );
QMessageBox::critical( this, tr( "Layer Creation Failed" ), tr( "Failed to create the output layer: %1" ).arg( errMsg ) );
mRunButton->setEnabled( true );
ui.labelStatus->hide();
unsetCursor();
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/geometry_snapper/qgsgeometrysnapperdialog.cpp
Expand Up @@ -220,10 +220,11 @@ void QgsGeometrySnapperDialog::run()
QgsMapLayerRegistry::instance()->removeMapLayers( toRemove );
}

QgsVectorFileWriter::WriterError err = QgsVectorFileWriter::writeAsVectorFormat( layer, filename, layer->dataProvider()->encoding(), &layer->crs(), mOutputDriverName, selectedOnly );
QString errMsg;
QgsVectorFileWriter::WriterError err = QgsVectorFileWriter::writeAsVectorFormat( layer, filename, layer->dataProvider()->encoding(), &layer->crs(), mOutputDriverName, selectedOnly, &errMsg );
if ( err != QgsVectorFileWriter::NoError )
{
QMessageBox::critical( this, tr( "Layer Creation Failed" ), tr( "Failed to create the output layer." ) );
QMessageBox::critical( this, tr( "Layer Creation Failed" ), tr( "Failed to create the output layer: %1" ).arg( errMsg ) );
return;
}
QgsVectorLayer* newlayer = new QgsVectorLayer( filename, QFileInfo( filename ).completeBaseName(), "ogr" );
Expand Down

0 comments on commit 9b7afc8

Please sign in to comment.