Commit cca7f0c5 authored by Jan Provaznik's avatar Jan Provaznik

Return specfic error message when moving an issue

parent 1e5ef1a2
......@@ -21,10 +21,9 @@ module EE
super
rescue ::Issues::BaseService::EpicAssignmentError => e
issue.errors.add(:epic_issue, e.message)
# because we can't be sure if these exceptions were raised because of epic
# we return just a generic error here for now
# https://gitlab.com/gitlab-org/gitlab/-/issues/247096
rescue ::Gitlab::Access::AccessDeniedError, ActiveRecord::RecordNotFound
rescue ::Gitlab::Access::AccessDeniedError
issue.errors.add(:base, 'You are not allowed to move the issue')
rescue ActiveRecord::RecordNotFound
issue.errors.add(:base, 'Resource not found')
end
......
---
title: Return more specific error message when moving issue in GraphQL API
merge_request: 44296
author:
type: changed
......@@ -36,7 +36,7 @@ RSpec.describe 'Reposition and move issue within board lists' do
project.add_maintainer(user)
end
context 'when user has access to the epic' do
context 'when user can admin epic' do
before do
group.add_maintainer(user)
end
......@@ -81,7 +81,7 @@ RSpec.describe 'Reposition and move issue within board lists' do
post_graphql_mutation(mutation(params), current_user: user)
mutation_response = graphql_mutation_response(:issue_move_list)
expect(mutation_response['errors']).to eq(['Resource not found'])
expect(mutation_response['errors']).to eq(['You are not allowed to move the issue'])
expect(mutation_response['issue']['epic']).to eq(nil)
expect(mutation_response['issue']['relativePosition']).to eq(3)
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