Make error handling of file reading more robust

This commit is contained in:
Kristóf Tóth 2018-02-09 15:59:26 +01:00
parent 8268e3e44a
commit 7720c63bc8

View File

@ -59,6 +59,8 @@ class SourceCodeEventHandler(EventHandlerBase, SupervisorMixin):
def read(self, data):
try: data['content'] = self.filemanager.file_contents
except PermissionError: data['content'] = 'You have no permission to open that file :('
except FileNotFoundError: data['content'] = 'This file was removed :('
except Exception: data['content'] = 'Failed to read file :('
return data
def write(self, data):