Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the error exception message #14889

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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