List Files: Catch more Runner::Errors

This commit is contained in:
Sebastian Serth
2022-11-14 13:51:04 +01:00
parent fa807eb7aa
commit d50e6d30e9
3 changed files with 10 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ class ExecutionEnvironmentsController < ApplicationController
downloadable_files, additional_directories = convert_files_json_to_files files
js_tree = FileTree.new(downloadable_files, additional_directories, force_closed: true).to_js_tree
render json: js_tree[:core][:data]
rescue Runner::Error::WorkspaceError
rescue Runner::Error::RunnerNotFound, Runner::Error::WorkspaceError
render json: []
end
end

View File

@@ -77,6 +77,9 @@ class Runner < ApplicationRecord
ensure
# We forward the exception if requested
raise e if raise_exception && defined?(e) && e.present?
# Otherwise, we return an hash with empty files
{'files' => []}
end
end