Raise comprehendable exception from webide when no files are present

This commit is contained in:
Kristóf Tóth 2018-04-26 11:09:31 +02:00
parent 8396c10a7b
commit 06e17a6591

View File

@ -111,8 +111,11 @@ class IdeEventHandler(EventHandlerBase, MonitorManagerMixin):
:param exclude: list of filenames that should not appear between files (for *.o, *.pyc, etc.)
"""
super().__init__(key)
self.filemanager = FileManager(allowed_directories=allowed_directories, working_directory=directory,
selected_file=selected_file, exclude=exclude)
try:
self.filemanager = FileManager(allowed_directories=allowed_directories, working_directory=directory,
selected_file=selected_file, exclude=exclude)
except IndexError:
raise EnvironmentError(f'No file(s) in IdeEventHandler working_directory "{directory}"!')
MonitorManagerMixin.__init__(self, DirectoryMonitor, self.filemanager.workdir)
self.commands = {'read': self.read,