List Files: Catch more Runner::Errors
This commit is contained in:
@ -44,7 +44,7 @@ class ExecutionEnvironmentsController < ApplicationController
|
|||||||
downloadable_files, additional_directories = convert_files_json_to_files files
|
downloadable_files, additional_directories = convert_files_json_to_files files
|
||||||
js_tree = FileTree.new(downloadable_files, additional_directories, force_closed: true).to_js_tree
|
js_tree = FileTree.new(downloadable_files, additional_directories, force_closed: true).to_js_tree
|
||||||
render json: js_tree[:core][:data]
|
render json: js_tree[:core][:data]
|
||||||
rescue Runner::Error::WorkspaceError
|
rescue Runner::Error::RunnerNotFound, Runner::Error::WorkspaceError
|
||||||
render json: []
|
render json: []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -77,6 +77,9 @@ class Runner < ApplicationRecord
|
|||||||
ensure
|
ensure
|
||||||
# We forward the exception if requested
|
# We forward the exception if requested
|
||||||
raise e if raise_exception && defined?(e) && e.present?
|
raise e if raise_exception && defined?(e) && e.present?
|
||||||
|
|
||||||
|
# Otherwise, we return an hash with empty files
|
||||||
|
{'files' => []}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -146,7 +146,12 @@ class Runner::Connection
|
|||||||
@strategy.destroy_at_management
|
@strategy.destroy_at_management
|
||||||
@error = Runner::Error::ExecutionTimeout.new('Execution exceeded its time limit')
|
@error = Runner::Error::ExecutionTimeout.new('Execution exceeded its time limit')
|
||||||
when :terminated_by_codeocean, :terminated_by_management
|
when :terminated_by_codeocean, :terminated_by_management
|
||||||
@exit_callback.call @exit_code, @strategy.retrieve_files
|
files = begin
|
||||||
|
@strategy.retrieve_files
|
||||||
|
rescue Runner::Error::RunnerNotFound, Runner::Error::WorkspaceError
|
||||||
|
{'files' => []}
|
||||||
|
end
|
||||||
|
@exit_callback.call @exit_code, files
|
||||||
when :terminated_by_client, :error
|
when :terminated_by_client, :error
|
||||||
@strategy.destroy_at_management
|
@strategy.destroy_at_management
|
||||||
else # :established
|
else # :established
|
||||||
|
Reference in New Issue
Block a user