mirror of
				https://github.com/JKorf/CryptoExchange.Net
				synced 2025-10-31 02:17:45 +00:00 
			
		
		
		
	ExtensionMethods: Add parameterName when throwing ArgumentException.
				
					
				
			This commit is contained in:
		
							parent
							
								
									02dfd192cb
								
							
						
					
					
						commit
						694dc5cbbb
					
				| @ -225,7 +225,7 @@ namespace CryptoExchange.Net | |||||||
|         { |         { | ||||||
|             if (!allowedValues.Contains(value)) |             if (!allowedValues.Contains(value)) | ||||||
|                 throw new ArgumentException( |                 throw new ArgumentException( | ||||||
|                     $"{value} not allowed for parameter {argumentName}, allowed values: {string.Join(", ", allowedValues)}"); |                     $"{value} not allowed for parameter {argumentName}, allowed values: {string.Join(", ", allowedValues)}", argumentName); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @ -239,7 +239,7 @@ namespace CryptoExchange.Net | |||||||
|         { |         { | ||||||
|             if (value < minValue || value > maxValue) |             if (value < minValue || value > maxValue) | ||||||
|                 throw new ArgumentException( |                 throw new ArgumentException( | ||||||
|                     $"{value} not allowed for parameter {argumentName}, min: {minValue}, max: {maxValue}"); |                     $"{value} not allowed for parameter {argumentName}, min: {minValue}, max: {maxValue}", argumentName); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @ -250,7 +250,7 @@ namespace CryptoExchange.Net | |||||||
|         public static void ValidateNotNull(this string value, string argumentName) |         public static void ValidateNotNull(this string value, string argumentName) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(value)) |             if (string.IsNullOrEmpty(value)) | ||||||
|                 throw new ArgumentException($"No value provided for parameter {argumentName}"); |                 throw new ArgumentException($"No value provided for parameter {argumentName}", argumentName); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @ -261,7 +261,7 @@ namespace CryptoExchange.Net | |||||||
|         public static void ValidateNotNull(this object value, string argumentName) |         public static void ValidateNotNull(this object value, string argumentName) | ||||||
|         { |         { | ||||||
|             if (value == null) |             if (value == null) | ||||||
|                 throw new ArgumentException($"No value provided for parameter {argumentName}"); |                 throw new ArgumentException($"No value provided for parameter {argumentName}", argumentName); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @ -272,7 +272,7 @@ namespace CryptoExchange.Net | |||||||
|         public static void ValidateNotNull<T>(this IEnumerable<T> value, string argumentName) |         public static void ValidateNotNull<T>(this IEnumerable<T> value, string argumentName) | ||||||
|         { |         { | ||||||
|             if (value == null || !value.Any()) |             if (value == null || !value.Any()) | ||||||
|                 throw new ArgumentException($"No values provided for parameter {argumentName}"); |                 throw new ArgumentException($"No values provided for parameter {argumentName}", argumentName); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user