Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
valdisiljuconoks committed Dec 23, 2023
1 parent e0b1f69 commit 6676fd6
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,9 @@ protected LocalizedAttributeAdapterBase(
/// <inheritdoc />
public override string GetErrorMessage(ModelValidationContextBase validationContext)
{
if (validationContext == null)
{
throw new ArgumentNullException(nameof(validationContext));
}
ArgumentNullException.ThrowIfNull(nameof(validationContext));

return _stringLocalizer?.GetString(
_resourceKeyBuilder.BuildResourceKey(
validationContext.ModelMetadata.ContainerType,
validationContext.ModelMetadata.PropertyName,
Attribute));
return GetErrorMessage(validationContext, null);
}

/// <summary>
Expand All @@ -52,9 +45,11 @@ public override string GetErrorMessage(ModelValidationContextBase validationCont
/// <returns>The localized error message.</returns>
public string GetErrorMessage(ModelValidationContextBase validationContext, params object[] arguments)
{
if (validationContext == null)
ArgumentNullException.ThrowIfNull(nameof(validationContext));

if (validationContext.ModelMetadata.ContainerType == null || validationContext.ModelMetadata.PropertyName == null)
{
throw new ArgumentNullException(nameof(validationContext));
return string.Empty;
}

return _stringLocalizer?.GetString(
Expand Down

0 comments on commit 6676fd6

Please sign in to comment.