Skip to content

Commit

Permalink
Fix the error exception message (#14889)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Dec 12, 2023
1 parent dc7cc46 commit 8f0c371
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public async Task<ContentTypeDefinition> AddTypeAsync(string name, string displa
{
if (string.IsNullOrWhiteSpace(displayName))
{
throw new ArgumentException("The 'displayName' can't be null or empty.", nameof(displayName));
throw new ArgumentException($"The '{nameof(displayName)}' can't be null or empty.", nameof(displayName));
}

if (string.IsNullOrWhiteSpace(name))
Expand Down Expand Up @@ -322,7 +322,7 @@ public async Task AddFieldToPartAsync(string fieldName, string displayName, stri
{
if (string.IsNullOrEmpty(fieldName))
{
throw new ArgumentException("The '{fieldName}' can't be null or empty.", nameof(fieldName));
throw new ArgumentException($"The '{nameof(fieldName)}' can't be null or empty.", nameof(fieldName));
}

var partDefinition = await _contentDefinitionManager.LoadPartDefinitionAsync(partName);
Expand Down Expand Up @@ -398,7 +398,7 @@ public Task AlterTypePartsOrderAsync(ContentTypeDefinition typeDefinition, strin
for (var i = 0; i < partNames.Length; i++)
{
var partDefinition = typeDefinition.Parts?.FirstOrDefault(x => x.Name == partNames[i]);
if (partDefinition == null)
{
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public PermissionGroupKey(string key)
{
if (string.IsNullOrWhiteSpace(key))
{
throw new ArgumentException("The 'key' cannot be null or empty", nameof(key));
throw new ArgumentException($"The '{nameof(key)}' cannot be null or empty", nameof(key));
}

Key = key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static void MoveUp<T>(List<T> list, int index, int lowerIndex)
{
if (index < lowerIndex)
{
throw new ArgumentException("Should be higher or equal to 'lowerIndex'.", nameof(index));
throw new ArgumentException($"Should be higher or equal to '{nameof(lowerIndex)}'.", nameof(index));
}

if (index != lowerIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static IConfigurationBuilder AddTenantJsonFile(this IConfigurationBuilder
if (string.IsNullOrEmpty(path))
{
// throw new ArgumentException(SR.Error_InvalidFilePath, nameof(path));
throw new ArgumentException($"File path must be a non-empty string.", nameof(path));
throw new ArgumentException("File path must be a non-empty string.", nameof(path));
}

return builder.AddTenantJsonFile(s =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static string ControllerName(this Type controllerType)
{
if (!typeof(Controller).IsAssignableFrom(controllerType))
{
throw new ArgumentException("The specified type must inherit from " + nameof(Controller), nameof(controllerType));
throw new ArgumentException($"The specified type must inherit from '{nameof(Controller)}'", nameof(controllerType));
}

return controllerType.Name.EndsWith(nameof(Controller), StringComparison.OrdinalIgnoreCase)
Expand Down

0 comments on commit 8f0c371

Please sign in to comment.