PARQUET-1218: More informative error message on too short pages

Author: Uwe L. Korn <uwelk@xhochy.com>

Closes #438 from xhochy/PARQUET-1218 and squashes the following commits:

20ba13d [Uwe L. Korn] PARQUET-1218: More informative error message on too short pages
diff --git a/src/parquet/column_reader.cc b/src/parquet/column_reader.cc
index 10d7210..bcbb339 100644
--- a/src/parquet/column_reader.cc
+++ b/src/parquet/column_reader.cc
@@ -180,7 +180,10 @@
     // Read the compressed data page.
     buffer = stream_->Read(compressed_len, &bytes_read);
     if (bytes_read != compressed_len) {
-      ParquetException::EofException();
+      std::stringstream ss;
+      ss << "Page was smaller (" << bytes_read << ") than expected (" << compressed_len
+         << ")";
+      ParquetException::EofException(ss.str());
     }
 
     // Uncompress it if we need to
diff --git a/src/parquet/exception.cc b/src/parquet/exception.cc
index 2278bc8..5f5525c 100644
--- a/src/parquet/exception.cc
+++ b/src/parquet/exception.cc
@@ -25,8 +25,13 @@
 
 namespace parquet {
 
-PARQUET_NORETURN void ParquetException::EofException() {
-  throw ParquetException("Unexpected end of stream.");
+PARQUET_NORETURN void ParquetException::EofException(const std::string& msg) {
+  std::stringstream ss;
+  ss << "Unexpected end of stream";
+  if (!msg.empty()) {
+    ss << ": " << msg;
+  }
+  throw ParquetException(ss.str());
 }
 
 PARQUET_NORETURN void ParquetException::NYI(const std::string& msg) {
diff --git a/src/parquet/exception.h b/src/parquet/exception.h
index 3748184..08629be 100644
--- a/src/parquet/exception.h
+++ b/src/parquet/exception.h
@@ -59,7 +59,7 @@
 
 class PARQUET_EXPORT ParquetException : public std::exception {
  public:
-  PARQUET_NORETURN static void EofException();
+  PARQUET_NORETURN static void EofException(const std::string& msg = "");
   PARQUET_NORETURN static void NYI(const std::string& msg);
   PARQUET_NORETURN static void Throw(const std::string& msg);