Commit 730d2533 authored by Sean Arnold's avatar Sean Arnold

Add project not found error

parent 1c030867
...@@ -39,6 +39,8 @@ module Mutations ...@@ -39,6 +39,8 @@ module Mutations
def resolve(iid:, project_path:, participants:, **args) def resolve(iid:, project_path:, participants:, **args)
project = Project.find_by_full_path(project_path) project = Project.find_by_full_path(project_path)
raise_project_not_found unless project
schedule = ::IncidentManagement::OncallSchedulesFinder.new(current_user, project, iid: iid) schedule = ::IncidentManagement::OncallSchedulesFinder.new(current_user, project, iid: iid)
.execute .execute
.first .first
...@@ -91,6 +93,10 @@ module Mutations ...@@ -91,6 +93,10 @@ module Mutations
user_array.map.with_index { |param, i| param.to_h.merge(user: matched_users[i]) } user_array.map.with_index { |param, i| param.to_h.merge(user: matched_users[i]) }
end end
def raise_project_not_found
raise Gitlab::Graphql::Errors::ArgumentError, 'The project could not be found'
end
def raise_schedule_not_found def raise_schedule_not_found
raise Gitlab::Graphql::Errors::ArgumentError, 'The schedule could not be found' raise Gitlab::Graphql::Errors::ArgumentError, 'The schedule could not be found'
end end
......
...@@ -90,6 +90,16 @@ RSpec.describe Mutations::IncidentManagement::OncallRotation::Create do ...@@ -90,6 +90,16 @@ RSpec.describe Mutations::IncidentManagement::OncallRotation::Create do
end end
end end
context 'project path incorrect' do
before do
args[:project_path] = "something/incorrect"
end
it 'raises an error' do
expect { resolve }.to raise_error(Gitlab::Graphql::Errors::ArgumentError, 'The project could not be found')
end
end
context 'duplicate participants' do context 'duplicate participants' do
before do before do
args[:participants] << args[:participants].first args[:participants] << args[:participants].first
......
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