Commit f69b5c9f authored by saikat sarkar's avatar saikat sarkar Committed by Peter Leitzen

Handle 500 error for GraphQL "configureSast" mutation

parent 0c968b0d
...@@ -22,6 +22,9 @@ module Security ...@@ -22,6 +22,9 @@ module Security
end end
result result
rescue Gitlab::Git::PreReceiveError => e
{ status: :error, errors: e.message }
end end
private private
......
---
title: Handle 500 error for GraphQL "configureSast" mutation
merge_request: 43936
author:
type: fixed
...@@ -38,6 +38,12 @@ RSpec.describe Security::CiConfiguration::SastCreateService, :snowplow do ...@@ -38,6 +38,12 @@ RSpec.describe Security::CiConfiguration::SastCreateService, :snowplow do
) )
end end
it 'raises exception if the user does not have permission to create a new branch' do
allow(project).to receive(:repository).and_raise(Gitlab::Git::PreReceiveError, "You are not allowed to create protected branches on this project.")
expect { subject }.to raise_error(Gitlab::Git::PreReceiveError)
end
context 'with no parameters' do context 'with no parameters' do
it 'returns the path to create a new merge request' do it 'returns the path to create a new merge request' do
expect(result[:status]).to eq(:success) expect(result[:status]).to eq(:success)
......
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