From 25dcfef524a6df7792a663bc91748cd126b40c22 Mon Sep 17 00:00:00 2001 From: Brett Samblanet Date: Thu, 29 Jun 2017 12:44:46 -0700 Subject: [PATCH] improving Exception messages for BatchSize and FlushTimeout --- .../FunctionResultAggregatorConfiguration.cs | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.Azure.WebJobs.Host/Loggers/Logger/Aggregator/FunctionResultAggregatorConfiguration.cs b/src/Microsoft.Azure.WebJobs.Host/Loggers/Logger/Aggregator/FunctionResultAggregatorConfiguration.cs index 4e7428390..118f884a7 100644 --- a/src/Microsoft.Azure.WebJobs.Host/Loggers/Logger/Aggregator/FunctionResultAggregatorConfiguration.cs +++ b/src/Microsoft.Azure.WebJobs.Host/Loggers/Logger/Aggregator/FunctionResultAggregatorConfiguration.cs @@ -44,14 +44,10 @@ public int BatchSize set { - if (value <= 0) + if (value <= 0 || value > MaxBatchSize) { - throw new ArgumentOutOfRangeException(nameof(value)); - } - - if (value > MaxBatchSize) - { - throw new ArgumentOutOfRangeException(nameof(value)); + string message = $"'{nameof(BatchSize)}' value must be greater than 0 and less than or equal to {MaxBatchSize}."; + throw new ArgumentOutOfRangeException(null, value, message); } _batchSize = value; @@ -67,14 +63,10 @@ public TimeSpan FlushTimeout set { - if (value <= TimeSpan.Zero) - { - throw new ArgumentOutOfRangeException(nameof(value)); - } - - if (value > MaxFlushTimeout) + if (value <= TimeSpan.Zero || value > MaxFlushTimeout) { - throw new ArgumentOutOfRangeException(nameof(value)); + string message = $"'{nameof(FlushTimeout)}' value must be greater than '{TimeSpan.Zero.ToString()}' and less than or equal to '{MaxFlushTimeout.ToString()}'."; + throw new ArgumentOutOfRangeException(null, value, message); } _flushTimeout = value;