Skip to content

Commit

Permalink
review comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelbaran committed Jul 11, 2024
1 parent c74caee commit b067771
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions BHoM_Engine/Create/Type/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,14 @@ public static Type Type(string name, bool silent = false, bool takeFirstIfMultip
else if (types.Count == 1)
return types[0];
else if (types.Count > 1 && takeFirstIfMultiple)
return types.OrderBy(x => x.Assembly.FullName).First();
else if (!silent)
{
string message = "Ambiguous match: Multiple types correspond the the name provided: \n";
foreach (Type type in types)
message += "- " + type.FullName + "\n";
if (!silent)
Compute.RecordWarning($"Ambiguous match: Multiple types correspond the the name provided:\n{string.Join("\n", types.Select(x => x.FullName))}");

Compute.RecordError(message);
return types.OrderBy(x => x.Assembly.FullName).First();
}
else if (!silent)
Compute.RecordError($"Ambiguous match: Multiple types correspond the the name provided:\n{string.Join("\n", types.Select(x => x.FullName))}");

return null;
}
Expand Down

0 comments on commit b067771

Please sign in to comment.