Skip to content

Commit

Permalink
Add missing nameof() in thrown ArgumentException
Browse files Browse the repository at this point in the history
  • Loading branch information
bkoelman committed Dec 29, 2022
1 parent 75c056c commit be99234
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/JsonApiDotNetCore/Configuration/ResourceGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public IReadOnlyCollection<RelationshipAttribute> GetRelationships<TResource>(Ex

if (matchingField == null)
{
throw new ArgumentException($"Member '{memberName}' is not exposed as a JSON:API field.");
throw new ArgumentException($"Member '{memberName}' is not exposed as a JSON:API field.", nameof(selector));
}

matches.Add(matchingField);
Expand Down Expand Up @@ -178,8 +178,9 @@ private IEnumerable<string> ToMemberNames<TResource>(Expression<Func<TResource,
}
else
{
throw new ArgumentException($"The expression '{selector}' should select a single property or select multiple properties into an anonymous type. " +
"For example: 'article => article.Title' or 'article => new { article.Title, article.PageCount }'.");
throw new ArgumentException(
$"The expression '{selector}' should select a single property or select multiple properties into an anonymous type. " +
"For example: 'article => article.Title' or 'article => new { article.Title, article.PageCount }'.", nameof(selector));
}
}

Expand Down

0 comments on commit be99234

Please sign in to comment.