diff --git a/src/sentry/api/endpoints/project_stacktrace_link.py b/src/sentry/api/endpoints/project_stacktrace_link.py index eaf62d738db173..70819dbd690b99 100644 --- a/src/sentry/api/endpoints/project_stacktrace_link.py +++ b/src/sentry/api/endpoints/project_stacktrace_link.py @@ -2,6 +2,7 @@ from typing import Any, Dict, List, Mapping, Optional import requests +from rest_framework import status from rest_framework.request import Request from rest_framework.response import Response from sentry_sdk import Scope, configure_scope @@ -399,13 +400,19 @@ def get(self, request: Request, project: Project) -> Response: } if error.response.status_code != 404: logger.exception( - "Failed to get expected data from Codecov, pending investigation. Continuing execution." + "Failed to get expected data from Codecov. Continuing execution." ) except requests.Timeout: scope.set_tag("codecov.timeout", True) + result["codecov"] = { + "status": status.HTTP_408_REQUEST_TIMEOUT, + } logger.exception("Codecov request timed out. Continuing execution.") except Exception: - logger.exception("Something unexpected happen. Continuing execution.") + result["codecov"] = { + "status": status.HTTP_500_INTERNAL_SERVER_ERROR, + } + logger.exception("Something unexpected happened. Continuing execution.") # We don't expect coverage data if the integration does not exist (404) try: diff --git a/tests/sentry/api/endpoints/test_project_stacktrace_link.py b/tests/sentry/api/endpoints/test_project_stacktrace_link.py index d2b9b3edc201f9..a54c1eb19cbe47 100644 --- a/tests/sentry/api/endpoints/test_project_stacktrace_link.py +++ b/tests/sentry/api/endpoints/test_project_stacktrace_link.py @@ -513,7 +513,7 @@ def test_codecov_line_coverage_exception(self, mock_integration): ( "sentry.api.endpoints.project_stacktrace_link", logging.ERROR, - "Something unexpected happen. Continuing execution.", + "Something unexpected happened. Continuing execution.", ) ]