Skip to content
Permalink
Browse files

[Geometry checker] Be more verbose about output file creation failure…

… reason
  • Loading branch information
manisandro committed Jan 15, 2016
1 parent 2065850 commit 9b7afc8f4894f024991a11d700fa643ed86cc8ed
@@ -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();
@@ -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" );

0 comments on commit 9b7afc8

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