Selaa lähdekoodia

HUE-4726 [core] Display exceptions in logs when reading file formats

Jenny Kim 9 vuotta sitten
vanhempi
commit
d6437f9
1 muutettua tiedostoa jossa 8 lisäystä ja 8 poistoa
  1. 8 8
      apps/filebrowser/src/filebrowser/views.py

+ 8 - 8
apps/filebrowser/src/filebrowser/views.py

@@ -763,8 +763,8 @@ def _read_avro(fhandle, path, offset, length, stats):
             data_file_reader.close()
 
         contents = "".join(contents_list)
-    except:
-        logging.exception("Could not read avro file at %s" % path)
+    except Exception, e:
+        logging.exception('Could not read avro file at "%s": %s' % (path, e))
         raise PopupException(_("Failed to read Avro file."))
     return contents
 
@@ -778,8 +778,8 @@ def _read_parquet(fhandle, path, offset, length, stats):
         parquet._dump(data, ParquetOptions(), out=dumped_data)
         dumped_data.seek(offset)
         return dumped_data.read()
-    except:
-        logging.exception("Could not read parquet file at %s" % path)
+    except Exception, e:
+        logging.exception('Could not read parquet file at "%s": %s' % (path, e))
         raise PopupException(_("Failed to read Parquet file."))
 
 
@@ -789,8 +789,8 @@ def _read_gzip(fhandle, path, offset, length, stats):
         raise PopupException(_("Offsets are not supported with Gzip compression."))
     try:
         contents = GzipFile('', 'r', 0, StringIO(fhandle.read())).read(length)
-    except:
-        logging.exception("Could not decompress file at %s" % path)
+    except Exception, e:
+        logging.exception('Could not decompress file at "%s": %s' % (path, e))
         raise PopupException(_("Failed to decompress file."))
     return contents
 
@@ -800,8 +800,8 @@ def _read_simple(fhandle, path, offset, length, stats):
     try:
         fhandle.seek(offset)
         contents = fhandle.read(length)
-    except:
-        logging.exception("Could not read file at %s" % path)
+    except Exception, e:
+        logging.exception('Could not read file at "%s": %s' % (path, e))
         raise PopupException(_("Failed to read file."))
     return contents