8
8
namespace SixLabors
9
9
{
10
10
/// <summary>
11
- /// Helper methods to throw exceptions
11
+ /// Helper methods to throw exceptions.
12
12
/// </summary>
13
+ #pragma warning disable RCS1043 // Remove 'partial' modifier from type with a single part.
13
14
internal static partial class ThrowHelper
15
+ #pragma warning restore RCS1043 // Remove 'partial' modifier from type with a single part.
14
16
{
15
17
/// <summary>
16
18
/// Throws an <see cref="ArgumentNullException"/> when <see cref="Guard.NotNull{TValue}"/> fails.
17
19
/// </summary>
20
+ /// <param name="name">The argument name.</param>
18
21
[ DoesNotReturn ]
19
22
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
20
23
public static void ThrowArgumentNullExceptionForNotNull ( string name )
@@ -23,6 +26,8 @@ public static void ThrowArgumentNullExceptionForNotNull(string name)
23
26
/// <summary>
24
27
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.NotNullOrWhiteSpace"/> fails.
25
28
/// </summary>
29
+ /// <param name="value">The value.</param>
30
+ /// <param name="name">The argument name.</param>
26
31
[ DoesNotReturn ]
27
32
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
28
33
public static void ThrowArgumentExceptionForNotNullOrWhitespace ( string value , string name )
@@ -40,6 +45,10 @@ public static void ThrowArgumentExceptionForNotNullOrWhitespace(string value, st
40
45
/// <summary>
41
46
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.MustBeLessThan{TValue}"/> fails.
42
47
/// </summary>
48
+ /// <typeparam name="T">The type of value.</typeparam>
49
+ /// <param name="value">The value.</param>
50
+ /// <param name="max">The maximum allowable value.</param>
51
+ /// <param name="name">The argument name.</param>
43
52
[ DoesNotReturn ]
44
53
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
45
54
public static void ThrowArgumentOutOfRangeExceptionForMustBeLessThan < T > ( T value , T max , string name )
@@ -48,6 +57,10 @@ public static void ThrowArgumentOutOfRangeExceptionForMustBeLessThan<T>(T value,
48
57
/// <summary>
49
58
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.MustBeLessThanOrEqualTo{TValue}"/> fails.
50
59
/// </summary>
60
+ /// <typeparam name="T">The type of value.</typeparam>
61
+ /// <param name="value">The value.</param>
62
+ /// <param name="maximum">The maximum allowable value.</param>
63
+ /// <param name="name">The argument name.</param>
51
64
[ DoesNotReturn ]
52
65
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
53
66
public static void ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo < T > ( T value , T maximum , string name )
@@ -56,27 +69,45 @@ public static void ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo<T>
56
69
/// <summary>
57
70
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.MustBeGreaterThan{TValue}"/> fails.
58
71
/// </summary>
72
+ /// <typeparam name="T">The type of value.</typeparam>
73
+ /// <param name="value">The value.</param>
74
+ /// <param name="minimum">The minimum allowable value.</param>
75
+ /// <param name="name">The argument name.</param>
59
76
[ DoesNotReturn ]
60
77
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
61
- public static void ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan < T > ( T value , T minimum , string name ) => ThrowArgumentOutOfRangeException ( name , $ "Parameter \" { name } \" ({ typeof ( T ) } ) must be greater than { minimum } , was { value } ") ;
78
+ public static void ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan < T > ( T value , T minimum , string name )
79
+ => ThrowArgumentOutOfRangeException ( name , $ "Parameter \" { name } \" ({ typeof ( T ) } ) must be greater than { minimum } , was { value } ") ;
62
80
63
81
/// <summary>
64
82
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.MustBeGreaterThanOrEqualTo{TValue}"/> fails.
65
83
/// </summary>
84
+ /// <typeparam name="T">The type of value.</typeparam>
85
+ /// <param name="value">The value.</param>
86
+ /// <param name="minimum">The minimum allowable value.</param>
87
+ /// <param name="name">The argument name.</param>
66
88
[ DoesNotReturn ]
67
89
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
68
- public static void ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo < T > ( T value , T minimum , string name ) => ThrowArgumentOutOfRangeException ( name , $ "Parameter \" { name } \" ({ typeof ( T ) } ) must be greater than or equal to { minimum } , was { value } ") ;
90
+ public static void ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo < T > ( T value , T minimum , string name )
91
+ => ThrowArgumentOutOfRangeException ( name , $ "Parameter \" { name } \" ({ typeof ( T ) } ) must be greater than or equal to { minimum } , was { value } ") ;
69
92
70
93
/// <summary>
71
94
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.MustBeBetweenOrEqualTo{TValue}"/> fails.
72
95
/// </summary>
96
+ /// <typeparam name="T">The type of value.</typeparam>
97
+ /// <param name="value">The value.</param>
98
+ /// <param name="minimum">The minimum allowable value.</param>
99
+ /// <param name="maximum">The maximum allowable value.</param>
100
+ /// <param name="name">The argument name.</param>
73
101
[ DoesNotReturn ]
74
102
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
75
- public static void ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo < T > ( T value , T minimum , T maximum , string name ) => ThrowArgumentOutOfRangeException ( name , $ "Parameter \" { name } \" ({ typeof ( T ) } ) must be between or equal to { minimum } and { maximum } , was { value } ") ;
103
+ public static void ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo < T > ( T value , T minimum , T maximum , string name )
104
+ => ThrowArgumentOutOfRangeException ( name , $ "Parameter \" { name } \" ({ typeof ( T ) } ) must be between or equal to { minimum } and { maximum } , was { value } ") ;
76
105
77
106
/// <summary>
78
107
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.MustBeSizedAtLeast{T}(ReadOnlySpan{T},int,string)"/> fails.
79
108
/// </summary>
109
+ /// <param name="minLength">The minimum allowable length.</param>
110
+ /// <param name="parameterName">The paramere name.</param>
80
111
[ DoesNotReturn ]
81
112
[ MethodImpl ( MethodImplOptions . NoInlining ) ]
82
113
public static void ThrowArgumentOutOfRangeExceptionForMustBeSizedAtLeast ( int minLength , string parameterName )
0 commit comments