Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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@14130 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Aug 23, 2010
1 parent 5e1c98a commit 9806b3a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/qgsvectorfilewriter.cpp
Expand Up @@ -32,6 +32,7 @@
#include <QTextCodec>
#include <QTextStream>
#include <QSet>
#include <QMetaType>

#include <cassert>
#include <cstdlib> // size_t
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 9806b3a

Please sign in to comment.