Преглед на файлове

Improve exception message when attempting to read more bytes than available.

drieseng преди 9 години
родител
ревизия
8a97fecddd
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      src/Renci.SshNet/Common/SshDataStream.cs

+ 3 - 1
src/Renci.SshNet/Common/SshDataStream.cs

@@ -220,7 +220,9 @@ namespace Renci.SshNet.Common
             var bytesRead = Read(data, 0, length);
 
             if (bytesRead < length)
-                throw new ArgumentOutOfRangeException("length");
+                throw new ArgumentOutOfRangeException("length",
+                    string.Format(CultureInfo.InvariantCulture,
+                        "The requested length ({0}) is greater than the actual number of bytes read ({1}).", length, bytesRead));
 
             return data;
         }