Commit 14811e60 authored by Luke Duncalfe's avatar Luke Duncalfe

Enable error tracking in Jira::IssuesController

Previously these errors were logged to `AppLogger` but not to Sentry.

https://gitlab.com/gitlab-org/gitlab/-/issues/273726#note_520517236
parent 58b61bca
...@@ -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