mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:51:31 +00:00
Make error handling of file reading more robust
This commit is contained in:
parent
8268e3e44a
commit
7720c63bc8
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user