Skip to content

Commit

Permalink
More useful debug error message when trying to write a vector attribu…
Browse files Browse the repository at this point in the history
…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
Original file line number Diff line number Diff line change
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.