Skip to content

Commit 7763c24

Browse files
authored
fix(preprod): Report error on artifact failure (#100311)
1 parent 5427a3a commit 7763c24

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sentry/preprod/api/endpoints/project_preprod_build_details.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from sentry.preprod.api.models.project_preprod_build_details_models import (
1313
transform_preprod_artifact_to_build_details,
1414
)
15+
from sentry.preprod.models import PreprodArtifact
1516

1617
logger = logging.getLogger(__name__)
1718

@@ -52,5 +53,8 @@ def get(self, request: Request, project, head_artifact_id, head_artifact) -> Res
5253
):
5354
return Response({"error": "Feature not enabled"}, status=403)
5455

55-
build_details = transform_preprod_artifact_to_build_details(head_artifact)
56-
return Response(build_details.dict())
56+
if head_artifact.state == PreprodArtifact.ArtifactState.FAILED:
57+
return Response({"error": head_artifact.error_message}, status=400)
58+
else:
59+
build_details = transform_preprod_artifact_to_build_details(head_artifact)
60+
return Response(build_details.dict())

0 commit comments

Comments
 (0)