Skip to content

Commit a95a580

Browse files
Bart KoelmanBart Koelman
authored andcommitted
Better error message when string is null, empty or whitespace.
1 parent 55b5f56 commit a95a580

File tree

1 file changed

+3
-3
lines changed
  • src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer

1 file changed

+3
-3
lines changed

src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/Guard.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public static void NotNullNorEmpty<T>([CanBeNull] [ItemCanBeNull] IEnumerable<T>
4040
[ContractAnnotation("value: null => halt")]
4141
public static void NotNullNorWhiteSpace([CanBeNull] string value, [NotNull] [InvokerParameterName] string name)
4242
{
43-
NotNull(value, name);
44-
4543
if (string.IsNullOrWhiteSpace(value))
4644
{
47-
throw new ArgumentException($"'{name}' cannot be empty or contain only whitespace.", name);
45+
NotNullNorEmpty(value, name);
46+
47+
throw new ArgumentException($"'{name}' cannot contain only whitespace.", name);
4848
}
4949
}
5050
}

0 commit comments

Comments
 (0)