Skip to content

Commit

Permalink
Fix invalid usages of ArgumentNullException
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Mar 13, 2018
1 parent 2eeee62 commit f2b6df1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions GitExtUtils/Linq/LinqExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ public static Dictionary<TKey, List<TSource>> ToDictionaryOfList<TSource, TKey>(
foreach (TSource sourceElement in source)
{
TKey key = keySelector(sourceElement);

if (key == null)
{
var ex = new ArgumentNullException("KeySelector produced a key that is null. See exception data for source.");
var ex = new Exception("KeySelector produced a key that is null. See exception data for source.");
ex.Data.Add("source", sourceElement);
throw ex;
}
Expand Down Expand Up @@ -75,9 +76,10 @@ public static HashSet<TKey> ToHashSet<TSource, TKey>(this IEnumerable<TSource> s
foreach (TSource sourceElement in source)
{
TKey key = keySelector(sourceElement);

if (key == null)
{
var ex = new ArgumentNullException("KeySelector produced a key that is null. See exception data for source.");
var ex = new Exception("KeySelector produced a key that is null. See exception data for source.");
ex.Data.Add("source", sourceElement);
throw ex;
}
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Gerrit/GerritPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private bool HaveValidCommitMsgHook([NotNull] IGitModule gitModule, bool force)
{
if (gitModule == null)
{
throw new ArgumentNullException("gitDirectory");
throw new ArgumentNullException(nameof(gitModule));
}

string path = Path.Combine(gitModule.ResolveGitInternalPath("hooks"), "commit-msg");
Expand Down

0 comments on commit f2b6df1

Please sign in to comment.