Commit e3ac6c9d authored by Markus Koller's avatar Markus Koller

Merge branch '273726-enable-error-reporting-for-jira-issues-controller' into 'master'

Enable error tracking in Projects::Integrations::Jira::IssuesController

See merge request gitlab-org/gitlab!55578
parents 5f561b7d 14811e60
...@@ -107,12 +107,14 @@ module Projects ...@@ -107,12 +107,14 @@ module Projects
# Return the informational message to the user # Return the informational message to the user
def render_integration_error(exception) def render_integration_error(exception)
log_exception(exception)
render json: { errors: [exception.message] }, status: :bad_request render json: { errors: [exception.message] }, status: :bad_request
end end
# Log the specific request error details and return generic message # Log the specific request error details and return generic message
def render_request_error(exception) def render_request_error(exception)
Gitlab::AppLogger.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
......
...@@ -81,6 +81,7 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do ...@@ -81,6 +81,7 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do
it 'renders bad request for IntegrationError' do it 'renders bad request for IntegrationError' do
expect_any_instance_of(Projects::Integrations::Jira::IssuesFinder).to receive(:execute) expect_any_instance_of(Projects::Integrations::Jira::IssuesFinder).to receive(:execute)
.and_raise(Projects::Integrations::Jira::IssuesFinder::IntegrationError, 'Integration error') .and_raise(Projects::Integrations::Jira::IssuesFinder::IntegrationError, 'Integration error')
expect(Gitlab::ErrorTracking).to receive(:track_exception)
get :index, params: { namespace_id: project.namespace, project_id: project }, format: :json get :index, params: { namespace_id: project.namespace, project_id: project }, format: :json
...@@ -91,6 +92,7 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do ...@@ -91,6 +92,7 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do
it 'renders bad request for RequestError' do it 'renders bad request for RequestError' do
expect_any_instance_of(Projects::Integrations::Jira::IssuesFinder).to receive(:execute) expect_any_instance_of(Projects::Integrations::Jira::IssuesFinder).to receive(:execute)
.and_raise(Projects::Integrations::Jira::IssuesFinder::RequestError, 'Request error') .and_raise(Projects::Integrations::Jira::IssuesFinder::RequestError, 'Request error')
expect(Gitlab::ErrorTracking).to receive(:track_exception)
get :index, params: { namespace_id: project.namespace, project_id: project }, format: :json get :index, params: { namespace_id: project.namespace, project_id: project }, format: :json
......
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