Commit 95eb4833 by John Doe

added handling for data retrieval errors

parent 1ef89956
...@@ -65,6 +65,11 @@ class LoadElementData ...@@ -65,6 +65,11 @@ class LoadElementData
if data_service.success? if data_service.success?
combined_data.concat(data_service.data) combined_data.concat(data_service.data)
else else
#create error entries
error_entries = stream_elements.map do |e|
{id: e.id, type: 'error', values: nil}
end
combined_data.concat error_entries
add_warning("unable to retrieve data for #{stream.path}") add_warning("unable to retrieve data for #{stream.path}")
end end
end end
......
...@@ -86,7 +86,8 @@ RSpec.describe 'LoadElementData' do ...@@ -86,7 +86,8 @@ RSpec.describe 'LoadElementData' do
service.run([@elem0, @elem3],0,100) service.run([@elem0, @elem3],0,100)
expect(service.warnings.length).to eq 1 expect(service.warnings.length).to eq 1
expect(service.data).to eq [ expect(service.data).to eq [
{id: @elem0.id, values: 'mock0'} {id: @elem0.id, values: 'mock0'},
{id: @elem3.id, type: 'error', values: nil}
] ]
expect(@mock_stream_service.run_count).to eq 2 expect(@mock_stream_service.run_count).to eq 2
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment