Commit 199ae04f authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch...

Merge branch '323304-jira-issues-list-improve-user-facing-error-messages-when-fetch-fails' into 'master'

Prioritize server-provided error messages to present to users when Jira Issues list fails

See merge request gitlab-org/gitlab!60455
parents 9b466bb0 18534ff0
......@@ -62,9 +62,10 @@ export default {
<gl-sprintf :message="emptyStateDescription" />
</template>
<template v-if="!hasIssues" #actions>
<gl-button :href="issueCreateUrl" target="_blank" category="primary" variant="success"
>{{ s__('Integrations|Create new issue in Jira') }}<gl-icon name="external-link"
/></gl-button>
<gl-button :href="issueCreateUrl" target="_blank" category="primary" variant="success">
{{ s__('Integrations|Create new issue in Jira') }}
<gl-icon name="external-link" />
</gl-button>
</template>
</gl-empty-state>
</template>
......@@ -128,8 +128,11 @@ export default {
})
.catch((error) => {
this.issuesListLoadFailed = true;
const errors = error?.response?.data?.errors || [];
const errorMessage = errors[0] || __('An error occurred while loading issues');
createFlash({
message: __('An error occurred while loading issues'),
message: errorMessage,
captureError: true,
error,
});
......@@ -200,9 +203,10 @@ export default {
@filter="handleFilterIssues"
>
<template #nav-actions>
<gl-button :href="issueCreateUrl" target="_blank" class="gl-my-5"
>{{ s__('Integrations|Create new issue in Jira') }}<gl-icon name="external-link"
/></gl-button>
<gl-button :href="issueCreateUrl" target="_blank" class="gl-my-5">
{{ s__('Integrations|Create new issue in Jira') }}
<gl-icon name="external-link" />
</gl-button>
</template>
<template #reference="{ issuable }">
<span v-safe-html="jiraLogo" class="svg-container jira-logo-container"></span>
......
......@@ -106,7 +106,7 @@ module Projects
def render_request_error(exception)
log_exception(exception)
render json: { errors: [_('An error occurred while requesting data from the Jira service')] }, status: :bad_request
render json: { errors: [_('An error occurred while requesting data from the Jira service.')] }, status: :bad_request
end
end
end
......
......@@ -30,7 +30,7 @@ module Projects
raise IntegrationError, _('Jira service not configured.') unless jira_service&.active?
project_key = jira_service.project_key
raise IntegrationError, _('Jira project key is not configured') if project_key.blank?
raise IntegrationError, _('Jira project key is not configured.') if project_key.blank?
fetch_issues(project_key)
end
......
---
title: Display wider variety of error messages when Jira Issues List fails
merge_request: 60455
author:
type: changed
......@@ -97,7 +97,7 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do
get :index, params: { namespace_id: project.namespace, project_id: project }, format: :json
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['errors']).to eq ['An error occurred while requesting data from the Jira service']
expect(json_response['errors']).to eq ['An error occurred while requesting data from the Jira service.']
end
it 'sets pagination headers' do
......
......@@ -18,7 +18,7 @@ RSpec.describe Projects::Integrations::Jira::IssuesFinder do
context 'when jira service integration does not have project_key' do
it 'raises error' do
expect { subject }.to raise_error(Projects::Integrations::Jira::IssuesFinder::IntegrationError, 'Jira project key is not configured')
expect { subject }.to raise_error(Projects::Integrations::Jira::IssuesFinder::IntegrationError, 'Jira project key is not configured.')
end
end
......
......@@ -124,7 +124,7 @@ describe('JiraIssuesListRoot', () => {
describe('when request fails', () => {
it.each`
APIErrorMessage | expectedRenderedErrorMessage
${'API error'} | ${'An error occurred while loading issues'}
${'API error'} | ${'API error'}
${undefined} | ${'An error occurred while loading issues'}
`(
'calls `createFlash` with "$expectedRenderedErrorMessage" when API responds with "$APIErrorMessage"',
......
......@@ -3661,7 +3661,7 @@ msgstr ""
msgid "An error occurred while reordering issues."
msgstr ""
msgid "An error occurred while requesting data from the Jira service"
msgid "An error occurred while requesting data from the Jira service."
msgstr ""
msgid "An error occurred while retrieving calendar activity"
......@@ -18399,7 +18399,7 @@ msgstr ""
msgid "Jira integration not configured."
msgstr ""
msgid "Jira project key is not configured"
msgid "Jira project key is not configured."
msgstr ""
msgid "Jira project: %{importProject}"
......
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