log message when adding feature fails (#33151)

This commit is contained in:
Denis Rouzaud 2019-11-29 16:07:08 +01:00 committed by GitHub
parent 7333adecaf
commit 27341850b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,8 @@
#include "qgsvectordataprovider.h" #include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h" #include "qgsvectorlayer.h"
#include "qgsvectorlayerutils.h" #include "qgsvectorlayerutils.h"
#include "qgsmessagelog.h"
//! populate two lists (ks, vs) from map - in reverse order //! populate two lists (ks, vs) from map - in reverse order
template <class Key, class T> void mapToReversedLists( const QMap< Key, T > &map, QList<Key> &ks, QList<T> &vs ) template <class Key, class T> void mapToReversedLists( const QMap< Key, T > &map, QList<Key> &ks, QList<T> &vs )
@ -119,7 +121,10 @@ bool QgsVectorLayerEditBuffer::addFeature( QgsFeature &f )
return false; return false;
} }
if ( L->mFields.count() != f.attributes().count() ) if ( L->mFields.count() != f.attributes().count() )
{
QgsMessageLog::logMessage( tr( "cannot add feature, wrong field count: layer: %1 feature: %2:" ).arg( L->mFields.count() ).arg( f.attributes().count() ) );
return false; return false;
}
// TODO: check correct geometry type // TODO: check correct geometry type