Skip to content

Commit 3e9793f

Browse files
committed
ExceptionGuard made internal
1 parent 311c57a commit 3e9793f

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace PolylineAlgorithm.Internal.Diagnostics;
2626
/// attributes to avoid polluting callers' stack traces (__StackTraceHidden__ on supported targets)
2727
/// or to prevent inlining on older targets.
2828
/// </remarks>
29-
public static class ExceptionGuard {
29+
internal static class ExceptionGuard {
3030
/// <summary>
3131
/// Throws an <see cref="ArgumentOutOfRangeException"/> when a numeric argument is not a finite value.
3232
/// </summary>
@@ -37,7 +37,7 @@ public static class ExceptionGuard {
3737
[MethodImpl(MethodImplOptions.NoInlining)]
3838
#endif
3939
[DoesNotReturn]
40-
public static void ThrowNotFiniteNumber(string paramName) {
40+
internal static void ThrowNotFiniteNumber(string paramName) {
4141
throw new ArgumentOutOfRangeException(paramName, ExceptionMessage.GetArgumentValueMustBeFiniteNumber());
4242
}
4343

@@ -51,7 +51,7 @@ public static void ThrowNotFiniteNumber(string paramName) {
5151
[MethodImpl(MethodImplOptions.NoInlining)]
5252
#endif
5353
[DoesNotReturn]
54-
public static void ThrowArgumentNull(string paramName) {
54+
internal static void ThrowArgumentNull(string paramName) {
5555
throw new ArgumentNullException(paramName);
5656
}
5757

@@ -65,7 +65,7 @@ public static void ThrowArgumentNull(string paramName) {
6565
[MethodImpl(MethodImplOptions.NoInlining)]
6666
#endif
6767
[DoesNotReturn]
68-
public static void ThrowBufferOverflow(string message) {
68+
internal static void ThrowBufferOverflow(string message) {
6969
throw new OverflowException(message);
7070
}
7171

@@ -82,7 +82,7 @@ public static void ThrowBufferOverflow(string message) {
8282
[MethodImpl(MethodImplOptions.NoInlining)]
8383
#endif
8484
[DoesNotReturn]
85-
public static void ThrowCoordinateValueOutOfRange(double value, double min, double max, string paramName) {
85+
internal static void ThrowCoordinateValueOutOfRange(double value, double min, double max, string paramName) {
8686
throw new ArgumentOutOfRangeException(paramName, ExceptionMessage.FormatCoordinateValueMustBeBetween(paramName, min, max));
8787
}
8888

@@ -97,7 +97,7 @@ public static void ThrowCoordinateValueOutOfRange(double value, double min, doub
9797
[MethodImpl(MethodImplOptions.NoInlining)]
9898
#endif
9999
[DoesNotReturn]
100-
public static void StackAllocLimitMustBeEqualOrGreaterThan(int minValue, string paramName) {
100+
internal static void StackAllocLimitMustBeEqualOrGreaterThan(int minValue, string paramName) {
101101
throw new ArgumentOutOfRangeException(paramName, ExceptionMessage.FormatStackAllocLimitMustBeEqualOrGreaterThan(minValue));
102102
}
103103

@@ -111,7 +111,7 @@ public static void StackAllocLimitMustBeEqualOrGreaterThan(int minValue, string
111111
[MethodImpl(MethodImplOptions.NoInlining)]
112112
#endif
113113
[DoesNotReturn]
114-
public static void ThrowArgumentCannotBeEmptyEnumerationMessage(string paramName) {
114+
internal static void ThrowArgumentCannotBeEmptyEnumerationMessage(string paramName) {
115115
throw new ArgumentException(ExceptionMessage.GetArgumentCannotBeEmpty(), paramName);
116116
}
117117

@@ -124,7 +124,7 @@ public static void ThrowArgumentCannotBeEmptyEnumerationMessage(string paramName
124124
[MethodImpl(MethodImplOptions.NoInlining)]
125125
#endif
126126
[DoesNotReturn]
127-
public static void ThrowCouldNotWriteEncodedValueToBuffer() {
127+
internal static void ThrowCouldNotWriteEncodedValueToBuffer() {
128128
throw new InvalidOperationException(ExceptionMessage.GetCouldNotWriteEncodedValueToTheBuffer());
129129
}
130130

@@ -140,7 +140,7 @@ public static void ThrowCouldNotWriteEncodedValueToBuffer() {
140140
[MethodImpl(MethodImplOptions.NoInlining)]
141141
#endif
142142
[DoesNotReturn]
143-
public static void ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(int destinationLength, int polylineLength, string paramName) {
143+
internal static void ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(int destinationLength, int polylineLength, string paramName) {
144144

145145
throw new ArgumentException(ExceptionMessage.FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(destinationLength, polylineLength), paramName);
146146
}
@@ -156,7 +156,7 @@ public static void ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLe
156156
[MethodImpl(MethodImplOptions.NoInlining)]
157157
#endif
158158
[DoesNotReturn]
159-
public static void ThrowInvalidPolylineLength(int length, int min) {
159+
internal static void ThrowInvalidPolylineLength(int length, int min) {
160160
throw new InvalidPolylineException(ExceptionMessage.FormatInvalidPolylineLength(length, min));
161161
}
162162

@@ -171,7 +171,7 @@ public static void ThrowInvalidPolylineLength(int length, int min) {
171171
[MethodImpl(MethodImplOptions.NoInlining)]
172172
#endif
173173
[DoesNotReturn]
174-
public static void ThrowInvalidPolylineCharacter(char character, int position) {
174+
internal static void ThrowInvalidPolylineCharacter(char character, int position) {
175175
throw new InvalidPolylineException(ExceptionMessage.FormatInvalidPolylineCharacter(character, position));
176176
}
177177

@@ -185,7 +185,7 @@ public static void ThrowInvalidPolylineCharacter(char character, int position) {
185185
[MethodImpl(MethodImplOptions.NoInlining)]
186186
#endif
187187
[DoesNotReturn]
188-
public static void ThrowPolylineBlockTooLong(int position) {
188+
internal static void ThrowPolylineBlockTooLong(int position) {
189189
throw new InvalidPolylineException(ExceptionMessage.FormatPolylineBlockTooLong(position));
190190
}
191191

@@ -199,7 +199,7 @@ public static void ThrowPolylineBlockTooLong(int position) {
199199
[MethodImpl(MethodImplOptions.NoInlining)]
200200
#endif
201201
[DoesNotReturn]
202-
public static void ThrowInvalidPolylineFormat(long position) {
202+
internal static void ThrowInvalidPolylineFormat(long position) {
203203
throw new InvalidPolylineException(ExceptionMessage.FormatMalformedPolyline(position));
204204
}
205205

@@ -212,7 +212,7 @@ public static void ThrowInvalidPolylineFormat(long position) {
212212
[MethodImpl(MethodImplOptions.NoInlining)]
213213
#endif
214214
[DoesNotReturn]
215-
public static void ThrowInvalidPolylineBlockTerminator() {
215+
internal static void ThrowInvalidPolylineBlockTerminator() {
216216
throw new InvalidPolylineException(ExceptionMessage.GetInvalidPolylineBlockTerminator());
217217
}
218218

@@ -221,7 +221,7 @@ public static void ThrowInvalidPolylineBlockTerminator() {
221221
/// </summary>
222222
/// <remarks>
223223
/// Keeps message formatting centralized so exception text remains consistent and can reuse
224-
/// resource strings. This class is public because messages are only used by the guard methods.
224+
/// resource strings. This class is internal because messages are only used by the guard methods.
225225
/// </remarks>
226226
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Internal use only.")]
227227
internal static class ExceptionMessage {
@@ -253,73 +253,73 @@ internal static class ExceptionMessage {
253253
/// <summary>
254254
/// Formats the message for stack allocation limit violations.
255255
/// </summary>
256-
public static string FormatStackAllocLimitMustBeEqualOrGreaterThan(int minValue) =>
256+
internal static string FormatStackAllocLimitMustBeEqualOrGreaterThan(int minValue) =>
257257
string.Format(CultureInfo.InvariantCulture, StackAllocLimitMustBeEqualOrGreaterThanFormat, minValue);
258258

259259
/// <summary>
260260
/// Formats the message when a polyline is shorter than the required minimum.
261261
/// </summary>
262-
public static string FormatPolylineCannotBeShorterThan(int length, int minLength) =>
262+
internal static string FormatPolylineCannotBeShorterThan(int length, int minLength) =>
263263
string.Format(CultureInfo.InvariantCulture, PolylineCannotBeShorterThanFormat, length, minLength);
264264

265265
/// <summary>
266266
/// Formats a message indicating the polyline is malformed at a given position.
267267
/// </summary>
268-
public static string FormatMalformedPolyline(long position) =>
268+
internal static string FormatMalformedPolyline(long position) =>
269269
string.Format(CultureInfo.InvariantCulture, PolylineIsMalformedAtFormat, position);
270270

271271
/// <summary>
272272
/// Formats a message indicating a coordinate parameter must be within a range.
273273
/// </summary>
274-
public static string FormatCoordinateValueMustBeBetween(string name, double min, double max) =>
274+
internal static string FormatCoordinateValueMustBeBetween(string name, double min, double max) =>
275275
string.Format(CultureInfo.InvariantCulture, CoordinateValueMustBeBetweenFormat, name, min, max);
276276

277277
/// <summary>
278278
/// Formats a message for polyline blocks that exceed allowed length.
279279
/// </summary>
280-
public static string FormatPolylineBlockTooLong(int position) =>
280+
internal static string FormatPolylineBlockTooLong(int position) =>
281281
string.Format(CultureInfo.InvariantCulture, PolylineBlockTooLongFormat, position);
282282

283283
/// <summary>
284284
/// Formats a message for invalid characters found in a polyline.
285285
/// </summary>
286-
public static string FormatInvalidPolylineCharacter(char character, int position) =>
286+
internal static string FormatInvalidPolylineCharacter(char character, int position) =>
287287
string.Format(CultureInfo.InvariantCulture, InvalidPolylineCharacterFormat, character, position);
288288

289289
/// <summary>
290290
/// Formats a message when a destination array is too small for the polyline.
291291
/// </summary>
292-
public static string FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(int destinationLength, int polylineLength) =>
292+
internal static string FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(int destinationLength, int polylineLength) =>
293293
string.Format(CultureInfo.InvariantCulture, DestinationArrayLengthMustBeEqualOrGreaterThanPolylineLengthFormat, destinationLength, polylineLength);
294294

295295
/// <summary>
296296
/// Formats an invalid polyline length message.
297297
/// </summary>
298-
public static string FormatInvalidPolylineLength(int length, int min) =>
298+
internal static string FormatInvalidPolylineLength(int length, int min) =>
299299
string.Format(CultureInfo.InvariantCulture, InvalidPolylineLengthFormat, length, min);
300300

301301
/// <summary>
302302
/// Gets the message used when a numeric argument must be finite.
303303
/// </summary>
304-
public static string GetArgumentValueMustBeFiniteNumber() =>
304+
internal static string GetArgumentValueMustBeFiniteNumber() =>
305305
ArgumentValueMustBeFiniteNumberMessage;
306306

307307
/// <summary>
308308
/// Gets the message used when the library could not write an encoded value to a buffer.
309309
/// </summary>
310-
public static string GetCouldNotWriteEncodedValueToTheBuffer() =>
310+
internal static string GetCouldNotWriteEncodedValueToTheBuffer() =>
311311
CouldNotWriteEncodedValueToTheBufferMessage;
312312

313313
/// <summary>
314314
/// Gets the message used when an argument collection must not be empty.
315315
/// </summary>
316-
public static string GetArgumentCannotBeEmpty() =>
316+
internal static string GetArgumentCannotBeEmpty() =>
317317
ArgumentCannotBeEmptyMessage;
318318

319319
/// <summary>
320320
/// Gets the message used when a polyline block terminator is invalid.
321321
/// </summary>
322-
public static string GetInvalidPolylineBlockTerminator() =>
322+
internal static string GetInvalidPolylineBlockTerminator() =>
323323
InvalidPolylineBlockTerminatorMessage;
324324
}
325325
}

0 commit comments

Comments
 (0)