Commit af4eb9be authored by Mehmet Emin INAC's avatar Mehmet Emin INAC Committed by Stan Hu

Do not propagate parsing exceptions to clients for `pipelineFindings`

parent 32fe1691
......@@ -23,7 +23,12 @@ module Resolvers
description: 'Filter vulnerability findings by state.'
def resolve(**args)
# This finder class has been deprecated and will be removed by
# https://gitlab.com/gitlab-org/gitlab/-/issues/334488.
# We can remove the rescue block while addressing that issue.
Security::PipelineVulnerabilitiesFinder.new(pipeline: pipeline, params: args).execute.findings
rescue Security::PipelineVulnerabilitiesFinder::ParseError
[]
end
end
end
......@@ -63,5 +63,17 @@ RSpec.describe Resolvers::PipelineSecurityReportFindingsResolver do
expect(Security::PipelineVulnerabilitiesFinder).to have_received(:new).with(pipeline: pipeline, params: params)
end
end
context 'when the finder class raises parsing error' do
before do
allow_next_instance_of(Security::PipelineVulnerabilitiesFinder) do |finder|
allow(finder).to receive(:execute).and_raise(Security::PipelineVulnerabilitiesFinder::ParseError)
end
end
it 'does not propagate the error to the client' do
expect { resolve_query }.not_to raise_error
end
end
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 to comment