Skip to content

Commit 9136501

Browse files
authored
Merge pull request #67 from CommunityToolkit/dev/dot-terminated-exceptions
Add missing trailing dot to exception messages
2 parents ab97136 + f6b604a commit 9136501

30 files changed

+216
-216
lines changed

CommunityToolkit.Common/Collections/ObservableGroupedCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static ObservableGroup<TKey, TValue> First<TKey, TValue>(this ObservableG
3434
{
3535
static void ThrowArgumentExceptionForKeyNotFound()
3636
{
37-
throw new InvalidOperationException("The requested key was not present in the collection");
37+
throw new InvalidOperationException("The requested key was not present in the collection.");
3838
}
3939

4040
ThrowArgumentExceptionForKeyNotFound();

CommunityToolkit.Common/Extensions/ISettingsStorageHelperExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ public static void Delete<TKey>(this ISettingsStorageHelper<TKey> storageHelper,
7676

7777
private static void ThrowKeyNotFoundException<TKey>(TKey key)
7878
{
79-
throw new KeyNotFoundException($"The given key '{key}' was not present");
79+
throw new KeyNotFoundException($"The given key '{key}' was not present.");
8080
}
8181
}

CommunityToolkit.Diagnostics/Generated/ThrowHelper.Collection.g.cs

Lines changed: 88 additions & 88 deletions
Large diffs are not rendered by default.

CommunityToolkit.Diagnostics/Generated/ThrowHelper.Collection.tt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ GenerateTextForItems(EnumerableTypes, item =>
2828
[DoesNotReturn]
2929
public static void ThrowArgumentExceptionForIsEmpty<T>(<#=item.Type#> <#=item.Name#>, string name)
3030
{
31-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must be empty, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}", name);
31+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must be empty, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
3232
}
3333

3434
/// <summary>
@@ -37,7 +37,7 @@ GenerateTextForItems(EnumerableTypes, item =>
3737
[DoesNotReturn]
3838
public static void ThrowArgumentExceptionForHasSizeEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
3939
{
40-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}", name);
40+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
4141
}
4242

4343
/// <summary>
@@ -46,7 +46,7 @@ GenerateTextForItems(EnumerableTypes, item =>
4646
[DoesNotReturn]
4747
public static void ThrowArgumentExceptionForHasSizeNotEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
4848
{
49-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size not equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}", name);
49+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size not equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
5050
}
5151

5252
/// <summary>
@@ -55,7 +55,7 @@ GenerateTextForItems(EnumerableTypes, item =>
5555
[DoesNotReturn]
5656
public static void ThrowArgumentExceptionForHasSizeGreaterThan<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
5757
{
58-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size over {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}", name);
58+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size over {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
5959
}
6060

6161
/// <summary>
@@ -64,7 +64,7 @@ GenerateTextForItems(EnumerableTypes, item =>
6464
[DoesNotReturn]
6565
public static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
6666
{
67-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size of at least {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}", name);
67+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size of at least {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
6868
}
6969

7070
/// <summary>
@@ -73,7 +73,7 @@ GenerateTextForItems(EnumerableTypes, item =>
7373
[DoesNotReturn]
7474
public static void ThrowArgumentExceptionForHasSizeLessThan<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
7575
{
76-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}", name);
76+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
7777
}
7878

7979
/// <summary>
@@ -82,7 +82,7 @@ GenerateTextForItems(EnumerableTypes, item =>
8282
[DoesNotReturn]
8383
public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
8484
{
85-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than or equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}", name);
85+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than or equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
8686
}
8787

8888
/// <summary>
@@ -91,7 +91,7 @@ GenerateTextForItems(EnumerableTypes, item =>
9191
[DoesNotReturn]
9292
public static void ThrowArgumentExceptionForHasSizeEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, string name)
9393
{
94-
throw new ArgumentException($"The source {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size equal to {AssertString(destination.<#=item.Size#>)} (the destination), had a size of {AssertString(source.<#=item.Size#>)}", name);
94+
throw new ArgumentException($"The source {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size equal to {AssertString(destination.<#=item.Size#>)} (the destination), had a size of {AssertString(source.<#=item.Size#>)}.", name);
9595
}
9696

9797
/// <summary>
@@ -100,7 +100,7 @@ GenerateTextForItems(EnumerableTypes, item =>
100100
[DoesNotReturn]
101101
public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, string name)
102102
{
103-
throw new ArgumentException($"The source {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than or equal to {AssertString(destination.<#=item.Size#>)} (the destination), had a size of {AssertString(source.<#=item.Size#>)}", name);
103+
throw new ArgumentException($"The source {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than or equal to {AssertString(destination.<#=item.Size#>)} (the destination), had a size of {AssertString(source.<#=item.Size#>)}.", name);
104104
}
105105

106106
/// <summary>
@@ -109,7 +109,7 @@ GenerateTextForItems(EnumerableTypes, item =>
109109
[DoesNotReturn]
110110
public static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, string name)
111111
{
112-
throw new ArgumentOutOfRangeException(name, index, $"Parameter {AssertString(name)} (int) must be in the range given by <0> and {AssertString(<#=item.Name#>.<#=item.Size#>)} to be a valid index for the target collection ({typeof(<#=item.Type#>).ToTypeString()}), was {AssertString(index)}");
112+
throw new ArgumentOutOfRangeException(name, index, $"Parameter {AssertString(name)} (int) must be in the range given by <0> and {AssertString(<#=item.Name#>.<#=item.Size#>)} to be a valid index for the target collection ({typeof(<#=item.Type#>).ToTypeString()}), was {AssertString(index)}.");
113113
}
114114

115115
/// <summary>
@@ -118,7 +118,7 @@ GenerateTextForItems(EnumerableTypes, item =>
118118
[DoesNotReturn]
119119
public static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, string name)
120120
{
121-
throw new ArgumentOutOfRangeException(name, index, $"Parameter {AssertString(name)} (int) must not be in the range given by <0> and {AssertString(<#=item.Name#>.<#=item.Size#>)} to be an invalid index for the target collection ({typeof(<#=item.Type#>).ToTypeString()}), was {AssertString(index)}");
121+
throw new ArgumentOutOfRangeException(name, index, $"Parameter {AssertString(name)} (int) must not be in the range given by <0> and {AssertString(<#=item.Name#>.<#=item.Size#>)} to be an invalid index for the target collection ({typeof(<#=item.Type#>).ToTypeString()}), was {AssertString(index)}.");
122122
}
123123
<#
124124
});

CommunityToolkit.Diagnostics/Internals/Guard.Collection.Generic.ThrowHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private static partial class ThrowHelper
2525
[DoesNotReturn]
2626
public static void ThrowArgumentExceptionForIsNotEmptyWithSpan<T>(string name)
2727
{
28-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(Span<T>).ToTypeString()}) must not be empty", name);
28+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(Span<T>).ToTypeString()}) must not be empty.", name);
2929
}
3030

3131
/// <summary>
@@ -36,7 +36,7 @@ public static void ThrowArgumentExceptionForIsNotEmptyWithSpan<T>(string name)
3636
[DoesNotReturn]
3737
public static void ThrowArgumentExceptionForIsNotEmptyWithReadOnlySpan<T>(string name)
3838
{
39-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(ReadOnlySpan<T>).ToTypeString()}) must not be empty", name);
39+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(ReadOnlySpan<T>).ToTypeString()}) must not be empty.", name);
4040
}
4141

4242
/// <summary>
@@ -46,7 +46,7 @@ public static void ThrowArgumentExceptionForIsNotEmptyWithReadOnlySpan<T>(string
4646
[DoesNotReturn]
4747
public static void ThrowArgumentExceptionForIsNotEmpty<T>(string name)
4848
{
49-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(T).ToTypeString()}) must not be empty", name);
49+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(T).ToTypeString()}) must not be empty.", name);
5050
}
5151
}
5252
}

0 commit comments

Comments
 (0)