Clarify EnvironmentNotFound error handling
This commit is contained in:
@ -78,13 +78,17 @@ class Runner < ApplicationRecord
|
||||
self.runner_id = strategy_class.request_from_management(execution_environment)
|
||||
@strategy = strategy_class.new(runner_id, execution_environment)
|
||||
rescue Runner::Error::EnvironmentNotFound
|
||||
# Whenever the environment could not be found by the runner management, we
|
||||
# try to synchronize it and then forward a more specific error to our callee.
|
||||
if strategy_class.sync_environment(execution_environment)
|
||||
raise Runner::Error::EnvironmentNotFound.new(
|
||||
"The execution environment with id #{execution_environment.id} was not found and was successfully synced with the runner management"
|
||||
"The execution environment with id #{execution_environment.id} was not found yet by the runner management. "\
|
||||
'It has been successfully synced now so that the next request should be successful.'
|
||||
)
|
||||
else
|
||||
raise Runner::Error::EnvironmentNotFound.new(
|
||||
"The execution environment with id #{execution_environment.id} was not found and could not be synced with the runner management"
|
||||
"The execution environment with id #{execution_environment.id} was not found by the runner management."\
|
||||
'In addition, it could not be synced so that this probably indicates a permanent error.'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user