Skip to content

Commit

Permalink
Throw descriptive exception when a field is added with no type. (#14569)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Oct 26, 2023
1 parent 7817e22 commit 829706d
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ private static void Apply(ContentPartDefinition model, ContentPartDefinitionReco
var partFieldRecord = record.ContentPartFieldDefinitionRecords.FirstOrDefault(r => string.Equals(r.Name, fieldName, StringComparison.OrdinalIgnoreCase));
if (partFieldRecord == null)
{
if (field.FieldDefinition == null)
{
throw new InvalidOperationException($"The '{field.Name}' field in '{model.Name}' part was defined without a specified type. Please review the migration and explicitly specify the field type.");
}

partFieldRecord = new ContentPartFieldDefinitionRecord
{
FieldName = field.FieldDefinition.Name,
Expand Down

0 comments on commit 829706d

Please sign in to comment.