Commit 374bf0c8 authored by Stan Hu's avatar Stan Hu

Merge branch 'dont_raise_exceptions_on_pipeline_findings_graphql' into 'master'

Do not propagate parsing exceptions to clients for `pipelineFindings`

See merge request gitlab-org/gitlab!74427
parents 158e643f af4eb9be
......@@ -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