Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
95eb4833
authored
Jun 05, 2017
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added handling for data retrieval errors
parent
1ef89956
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
app/services/data/load_element_data.rb
spec/services/data/load_element_data_spec.rb
app/services/data/load_element_data.rb
View file @
95eb4833
...
@@ -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
...
...
spec/services/data/load_element_data_spec.rb
View file @
95eb4833
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment