Commit a8025011 authored by Luke Lowery's avatar Luke Lowery Committed by Tao Feng

Adding an if statement to prevent an exception when closing a file that is not opened (#184)

parent 8592c668
......@@ -48,7 +48,8 @@ class FileSystemCSVLoader(Loader):
:return:
"""
try:
self.file_handler.close()
if self.file_handler:
self.file_handler.close()
except Exception as e:
logging.warning("Failed trying to close a file handler! %s",
str(e))
......
......@@ -62,7 +62,8 @@ class FSElasticsearchJSONLoader(Loader):
close the file handler
:return:
"""
self.file_handler.close()
if self.file_handler:
self.file_handler.close()
def get_scope(self):
# type: () -> str
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment