Move error handling to else branch in execute_command

This commit is contained in:
Sebastian Serth
2021-10-17 23:36:50 +02:00
parent 95f97bd66e
commit a6a477e361

View File

@ -139,16 +139,13 @@ class Runner::Strategy::Poseidon < Runner::Strategy
when 200
response_body = self.class.parse response
websocket_url = response_body[:websocketUrl]
if websocket_url.present?
return websocket_url
else
raise Runner::Error::UnexpectedResponse.new('Poseidon did not send a WebSocket URL')
end
websocket_url.presence || raise(Runner::Error::UnexpectedResponse.new('Poseidon did not send a WebSocket URL'))
when 400
Runner.destroy(@allocation_id)
self.class.handle_error response
else
self.class.handle_error response
end
self.class.handle_error response
rescue Faraday::Error => e
raise Runner::Error::FaradayError.new("Request to Poseidon failed: #{e.inspect}")
end