mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-23 00:21:32 +00:00
Implement error handling in SourceCodeEventHandler.select_dir()
This commit is contained in:
parent
20895cb989
commit
3b241a3930
@ -90,8 +90,15 @@ class SourceCodeEventHandler(TriggerlessEventHandler):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def select_dir(self, data):
|
def select_dir(self, data):
|
||||||
try: self.filemanager.workdir = data['directory']
|
try:
|
||||||
except EnvironmentError: log.exception('Failed to select directory "{}"'.format(data['directory']))
|
self.filemanager.workdir = data['directory']
|
||||||
|
try:
|
||||||
|
self.filemanager.select_file(self.filemanager.files[0])
|
||||||
|
data['content'] = self.filemanager.file_contents
|
||||||
|
except IndexError:
|
||||||
|
data['content'] = 'No files in this directory :('
|
||||||
|
except EnvironmentError:
|
||||||
|
log.exception('Failed to select directory "{}"'.format(data['directory']))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def attach_fileinfo(self, data):
|
def attach_fileinfo(self, data):
|
||||||
|
Loading…
Reference in New Issue
Block a user