Source

IronPython.Zlib / IronPython.Zlib / Decompress.cs

Diff from to

File IronPython.Zlib/Decompress.cs

 using System.Text;
 using IronPython.Runtime;
 using ComponentAce.Compression.Libs.ZLib;
+using IronPython.Runtime.Operations;
 
 namespace IronPython.Zlib
 {
 
             if(err != ZlibModule.Z_OK)
             {
-                throw new ZStreamException();
+                throw PythonOps.ValueError("Error initializing inflate.");
             }
 
             _unused_data = string.Empty;
             }
             else if(err != Z_OK && err != Z_BUF_ERROR)
             {
-                throw new ZStreamException();
+                throw PythonOps.ValueError("inflate error");
             }
 
             return ZlibModule.Latin1.GetString(output, 0, (int)(zst.total_out - start_total_out));
 
         public string flush(int length)
         {
+            if(length < 1)
+                throw PythonOps.ValueError("length must be greater than 0.");
+
             byte[] output = new byte[length];
 
             long start_total_out = zst.total_out;
                 err = zst.inflateEnd();
                 if(err != Z_OK)
                 {
-                    throw new ZStreamException();
+                    throw PythonOps.ValueError("Error finishing inflate.");
                 }
             }