Skip to content

Commit ad3490e

Browse files
author
timlinux
committed
More useful debug error message when trying to write a vector attribute with an invalid QVariant type. Message displayed now looks like this: Invalid variant type for field lon 1: Expected Type float : Received Value: 20.375
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14130 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 7a2e0b6 commit ad3490e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/core/qgsvectorfilewriter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <QTextCodec>
3333
#include <QTextStream>
3434
#include <QSet>
35+
#include <QMetaType>
3536

3637
#include <cassert>
3738
#include <cstdlib> // size_t
@@ -341,7 +342,10 @@ bool QgsVectorFileWriter::addFeature( QgsFeature& feature )
341342
OGR_F_SetFieldString( poFeature, ogrField, mCodec->fromUnicode( attrValue.toString() ).data() );
342343
break;
343344
default:
344-
QgsDebugMsg( "Invalid variant type for field " + QString::number( ogrField ) + ": " + QString::number( attrValue.type() ) );
345+
QgsDebugMsg( "Invalid variant type for field " + QString( fldIt.value().name() ) + " "
346+
+ QString::number( ogrField ) + ": Received Type " + QMetaType::typeName ( attrValue.type() )
347+
+ " : With Value : " + attrValue.toString()
348+
);
345349
return false;
346350
}
347351
}

0 commit comments

Comments
 (0)