Skip to content

Commit

Permalink
Use EndOfStreamException for truncated reads
Browse files Browse the repository at this point in the history
  • Loading branch information
menees committed Sep 14, 2022
1 parent 98bbce9 commit 4646678
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<!-- Make the assembly, file, and NuGet package versions the same. -->
<!-- https://docs.microsoft.com/en-us/nuget/concepts/package-versioning#pre-release-versions -->
<Version>0.5.0-beta</Version>
<Version>0.6.0-beta</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
Expand Down
4 changes: 2 additions & 2 deletions src/Menees.Remoting/Models/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private static byte[] RequireRead(Stream stream, int requiredCount, string forWh

if (totalCount != requiredCount)
{
throw new ArgumentException(
throw new EndOfStreamException(
$"Unable to read {requiredCount} byte {forWhat} from stream. Only {totalCount} bytes were available.");
}

Expand Down Expand Up @@ -154,7 +154,7 @@ void ThrowIfCancellationRequested()
if (totalCount != requiredCount)
{
ThrowIfCancellationRequested();
throw new ArgumentException(
throw new EndOfStreamException(
$"Unable to read {requiredCount} byte {forWhat} from stream. Only {totalCount} bytes were available.");
}

Expand Down

0 comments on commit 4646678

Please sign in to comment.