Commit 2c65b2fc authored by Sean McGivern's avatar Sean McGivern

Merge branch 'epic-errmsg' into 'master'

Return specfic error message on epic assignment

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