Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Commit

Permalink
Change MinDataRate exception message to point out how to disable a mi…
Browse files Browse the repository at this point in the history
…n rate.
  • Loading branch information
Cesar Blum Silveira committed Jul 8, 2017
1 parent d793e0d commit 8ae3c46
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Microsoft.AspNetCore.Server.Kestrel.Core/CoreStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,7 @@
<data name="SynchronousWritesDisallowed" xml:space="preserve">
<value>Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.</value>
</data>
<data name="PositiveNumberOrNullMinDataRateRequired" xml:space="preserve">
<value>Value must be a positive number. To disable a minimum data rate, use null where a MinDataRate instance is expected.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public MinDataRate(double bytesPerSecond, TimeSpan gracePeriod)
{
if (bytesPerSecond <= 0)
{
throw new ArgumentOutOfRangeException(nameof(bytesPerSecond), CoreStrings.PositiveNumberRequired);
throw new ArgumentOutOfRangeException(nameof(bytesPerSecond), CoreStrings.PositiveNumberOrNullMinDataRateRequired);
}

if (gracePeriod <= Heartbeat.Interval)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void BytesPerSecondInvalid(double value)
var exception = Assert.Throws<ArgumentOutOfRangeException>(() => new MinDataRate(bytesPerSecond: value, gracePeriod: TimeSpan.MaxValue));

Assert.Equal("bytesPerSecond", exception.ParamName);
Assert.StartsWith(CoreStrings.PositiveNumberRequired, exception.Message);
Assert.StartsWith(CoreStrings.PositiveNumberOrNullMinDataRateRequired, exception.Message);
}

[Theory]
Expand Down

0 comments on commit 8ae3c46

Please sign in to comment.