mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2025-06-28 11:55:12 +00:00
Make error handling of file reading more robust
This commit is contained in:
@ -59,6 +59,8 @@ class SourceCodeEventHandler(EventHandlerBase, SupervisorMixin):
|
|||||||
def read(self, data):
|
def read(self, data):
|
||||||
try: data['content'] = self.filemanager.file_contents
|
try: data['content'] = self.filemanager.file_contents
|
||||||
except PermissionError: data['content'] = 'You have no permission to open that file :('
|
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
|
return data
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
|
Reference in New Issue
Block a user