Skip to content
Permalink
Browse files
More useful debug error message when trying to write a vector attribu…
…te 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
  • Loading branch information
timlinux committed Aug 23, 2010
1 parent 7a2e0b6 commit ad3490e62636299605efd4eb7060879510d4cd3b
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/core/qgsvectorfilewriter.cpp
@@ -32,6 +32,7 @@
#include <QTextCodec>
#include <QTextStream>
#include <QSet>
#include <QMetaType>

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

0 comments on commit ad3490e

Please sign in to comment.