Skip to content
Permalink
Browse files

File writer: better error message formatting

  • Loading branch information
elpaso authored and nyalldawson committed Jun 9, 2020
1 parent e629f8b commit 64675ca09028de9ddedbf0f8a74752c86946f44d
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/core/qgsvectorfilewriter.cpp
@@ -2414,14 +2414,14 @@ gdal::ogr_feature_unique_ptr QgsVectorFileWriter::createFeature( const QgsFeatur
attrValue = mFieldValueConverter->convert( fldIdx, attrValue );
}

// Check for conversion before passing attribute value to OGR
// Check type compatibility before passing attribute value to OGR
if ( ! field.convertCompatible( attrValue ) )
{
mErrorMessage = QObject::tr( "Invalid variant type for field %1[%2]: received %3 with type %4" )
.arg( mFields.at( fldIdx ).name() )
.arg( ogrField )
.arg( attrValue.typeName(),
attrValue.toString() );
mErrorMessage = QObject::tr( "Error converting value (%1) from %2 to %3 for attribute field %4" )
.arg( feature.attribute( fldIdx ).toString(),
mFields.at( fldIdx ).typeName(),
attrValue.typeName(),
mFields.at( fldIdx ).name() );
QgsMessageLog::logMessage( mErrorMessage, QObject::tr( "OGR" ) );
mError = ErrFeatureWriteFailed;
return nullptr;

0 comments on commit 64675ca

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