Split WebSocket event in multiple lines before processing

This commit is contained in:
Sebastian Serth
2021-10-10 15:12:45 +02:00
parent 1403fc03c4
commit cc98dc2229
3 changed files with 22 additions and 16 deletions

View File

@ -151,8 +151,8 @@ class Runner::Strategy::Poseidon < Runner::Strategy
end
class Connection < Runner::Connection
def decode(raw_event)
JSON.parse(raw_event.data)
def decode(event_data)
JSON.parse(event_data)
rescue JSON::ParserError => e
@error = Runner::Error::UnexpectedResponse.new("The WebSocket message from Poseidon could not be decoded to JSON: #{e.inspect}")
close(:error)