throw exception when trying to add same field name

This commit is contained in:
viperminiq 2025-05-06 11:16:55 +02:00 committed by Nyall Dawson
parent e79b3e18c5
commit fe34c45192
2 changed files with 2 additions and 4 deletions

View File

@ -120,8 +120,7 @@ bool QgsAddIncrementalFieldAlgorithm::prepareAlgorithm( const QVariantMap &param
if ( source->fields().lookupField( mFieldName ) >= 0 )
{
feedback->reportError( QObject::tr( "Field with the same name already exists" ) );
return false;
throw QgsProcessingException( QObject::tr( "Field with the same name already exists" ) );
}
return true;

View File

@ -131,8 +131,7 @@ bool QgsAddTableFieldAlgorithm::prepareAlgorithm( const QVariantMap &parameters,
if ( source->fields().lookupField( name ) >= 0 )
{
feedback->reportError( QObject::tr( "Field with the same name already exists" ) );
return false;
throw QgsProcessingException( QObject::tr( "Field with the same name already exists" ) );
}
mField.setName( name );